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

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


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Mon, 17 Jul 2023 12:51:56 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.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=6bMnT8j/thIsdisojHHqR+sOOlbPG+p+8Pu+VyJkT1s=; b=SGB4Qj4Zx8UO3IcroeqD3D3/NnyLlNhijg8gmT4qtHvuSDIXlikIHnf7/O5EiDYyuHI3gBulC9rRfUobmpvlsPBqzeBabrfyLyIzhHJ1dbEYYQ1o6fWJD9CN824XBsB79RWiaONstbd+a0mKIakg1/690cazs8gonW/8dBqHo1momEYpNG7Qf0ruFAMi7B8Xe33XLKmOWgfwSmlNcEYmNcKEUEhPiq6jW3tQuB2tnJ9vTuJVtiCV8mSctMe2cWt0ST9Bxt+osI7LiG91/VivyH/E1t7b1rMSQ1HXwn1rkogrA9+YD0DfPTCU55q27P+Bfkcqp8m7lpReTj+WXx6ctw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U2G3WPRKdsIpZN/kSdOrOs8TktzL1w2dAc0LE4fMIHSAcbDpsYdv2d+jXbBdvbKCJrvDJPAXgptOe/n48oEy2KDTfSsIjPKduwLFauV6g+lfwHNyQ5vrZ/JLBQVpy3q5K9C+QInEQxpmliTUdthARcYP0ZpJjC9MQie74hVMMkK50Vjmv+CApEaJa/vAIyOCN+1AmvvY/ND04fY8bJxPqjh/jT52i5DUonYPBBlWvUBuA7t3C/mzm9Q+JuYoo9obxYCyDx6qmrX+Rm1vUynJiY8uIB1nROyYV0x2dgrAwEhrrYVkORK8wDtbse3bn1ZlVXenr91PltTbsoDz52AZGg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Simone Ballarin <simone.ballarin@xxxxxxxxxxx>, Gianluca Luparini <gianluca.luparini@xxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • Delivery-date: Mon, 17 Jul 2023 10:52:18 +0000
  • Ironport-data: A9a23:01j7S69noz+sCsYcghtyDrUDcn+TJUtcMsCJ2f8bNWPcYEJGY0x3n WpKCmGFOvqLYTf2Lt5wOdux/R4C78XSx99jHQpuqSA8E34SpcT7XtnIdU2Y0wF+jCHgZBk+s 5hBMImowOQcFCK0SsKFa+C5xZVE/fjUAOG6UKicYXoZqTZMEE8JkQhkl/MynrlmiN24BxLlk d7pqojUNUTNNwRcawr40Ird7ks21BjOkGlA5AdmOqkU5Aa2e0Q9V/rzG4ngdxMUfaEMdgKKb 76r5K20+Grf4yAsBruN+losWhRXKlJ6FVHmZkt+A8BOsDAbzsAB+v9T2M4nQVVWk120c+VZk 72hg3ASpTABZcUgkMxFO/VR/roX0aduoNcrKlDn2SCfItGvn9IBDJyCAWlvVbD09NqbDklt0 6EjOjcjNyyRxLmTzKqcVdRJ3eg8eZyD0IM34hmMzBn/JNN/GNXvZvuP4tVVmjAtmspJAPDSI dIDbiZiZwjBZBsJPUoLDJU5n6GjgXyXnz9w8QrJ4/ZopTWMilUvgdABM/KMEjCObd9SkUuC4 HrP4kzyAw0ANczZwj2Amp6prraWzHugANhCTtVU8NZu0VqthWMYGCRKFn+rr/CWkk6yYo1Af hl8Fi0G6PJaGFaQZtv3UgC8oXWElgUBQNcWGOo/gCmdx6yR7wuHC2wsSj9adMdgpMIwXSYt1 FKCg5XuHzMHmKKRYWKQ8PGTtzzaETMUKGgEaGkORA8B6sPipqk5kx3UQ9BsVqWyi7XdFjD5x TSXpyF4g6gLhNQK0aST903ImD+qqd7CSQtdzh7MQmuv4wd9ZYikT4+l817W6bBHNonxc7Wal H0Nmszb4OVQC5iIzXWJWL9UQuDv4OuZOjrBh1IpB4Mm6zmm53+ke8ZX/S16I0BqdM0DfFcFf XPuhO+Y37cLVFPCUEO9S9vZ5xgCpUQ4KenYaw==
  • Ironport-hdrordr: A9a23:GUDlU6kKTFrfOtWY3FVDqF96RiDpDfIo3DAbv31ZSRFFG/Fw9v rDoB1/73TJYVkqN03I9ervBEDjexPhHO9OgLX5VI3KNGOKhILCFvAA0WKN+UyFJwTOssJbyK d8Y+xfJbTLfD9HZB/BkWuF+gAbsby6zJw=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Mon, Jul 17, 2023 at 11:31:57AM +0200, Jan Beulich wrote:
> 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>

Acked-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>

I have a question below, but not related to the change here.

> 
> --- 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 )

I do wonder whether this check is also accurate, as pIRQ 0 could be a
valid value.  Should it instead use INVALID_PIRQ?

Since there's no specification or documentation how this is supposed
to work it's hard to tell.

Thanks, Roger.



 


Rackspace

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