[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] x86/HVM: adjust pIRQ calculation in hvm_inject_msi()


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 17 Jul 2023 11:31:57 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ESRPs0bkbLM+33DkTgz3eY0sL1zyhmQSU3RxBzzc72Q=; b=lBH7//3w/7xNZ8pK74RhLVg8XZeEHnYkGbC1lIUEla/vXB8lOBtCmGdZc1OT0MuXxA4r/YIYf1bCs3NDWKfPc81VPjPjPP+UN4/ZAtTn9xfeltMZ7us8q/JmzamyYdsturFcSSXM+ODUCPJrA8JxSpIZUaW2xV3sv7w0C2rs9ctB+i2dMhSY5rmKroi+G6M4MTHjOUcSdeuyiItOS255U2/dHZJhKUVSjsea5LCgl9ENvBmDsSvjxWrdq4yriTF5tVZ6qJDPB22U6nfR2DIPh6shPhO/5sod9loasJRIFSz6gB/w5+fleeaWY7Z5624ES3OqblGIpKr67N4iD7KNIQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DdqqDGozAQXjE5WFW4jvUXNeI9tBCZJ5pg/Ru0OtX80fZJqD6nuNPBcAanBsFlZKqcqCrxHZxnZvAQGu7JdvwbLe4i+cF3JYkITT+CPC91bqZ8wOk0p3ip2nQw+0WYJZV1J1raKCd4KuTrjRz6os6wnApRI4TEC6hMuJ4j0076NaDk2mWfwo7cLQn7x6Fct7Nfi5RZ8qF/UJnYwkD5BJ7NvhXGpAVlvMcCfwaiEJPMwqAfhMeTRv8fm0T7k++G4+rOx0Bp6mBa7R0I+5V+sAMm1pBjA6tcmL2JUen7+lca2NoCkkWZ4PpDf97QnPcOHAaKimIrqawego+roumNjWEg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Simone Ballarin <simone.ballarin@xxxxxxxxxxx>, Gianluca Luparini <gianluca.luparini@xxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • Delivery-date: Mon, 17 Jul 2023 09:32:51 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

While the referenced commit came without any update to the public header
(which doesn't clarify how the upper address bits are used), the
intention looks to have been that bits 12..19 and 40..63 form the pIRQ.
Negative values simply make no sense, and pirq_info() also generally
wants invoking with an unsigned (and not just positive) value.

Since the line was pointed out by Eclair, address Misra rule 7.2 at the
same time, by adding the missing U suffix.

Fixes: 88fccdd11ca0 ("xen: event channel remapping for emulated MSIs")
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

--- a/xen/arch/x86/hvm/irq.c
+++ b/xen/arch/x86/hvm/irq.c
@@ -383,7 +383,7 @@ int hvm_inject_msi(struct domain *d, uin
 
     if ( !vector )
     {
-        int pirq = ((addr >> 32) & 0xffffff00) | dest;
+        unsigned int pirq = ((addr >> 32) & 0xffffff00U) | dest;
 
         if ( pirq > 0 )
         {



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.