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

Re: [PATCH 2/3] x86/vmsi: add support for extended destination ID in address field


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Fri, 4 Feb 2022 10:23:06 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; 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=9Ro+G7XcDQDdwFpozBkSjFjPo4+IMmlcDyncGzsGGMo=; b=NKYVUv+BMzTnEjzLzozlXQsmhESTVLSybF0JYVA9RUuw/aNNrZ/GwG/eXGv+SRujkepkW4yKGQ8gyOWqwZhpiZCXWxlblQ6an1TOV+r1+0zHVZoXbY+Neyw1rtZNm1/MespVV7D+/l+Ji7d7sECQesVmoN1s9GyMdgG9cQxMcB/hV2zgUcS/NPfLv+/lxDpHGByqE9Q7sQH/R50YRevH6XlxNrwP4bHJE+HvRWXmmkPRwGvfhW54TQ0k+gWne+0fEAqnRK5JxVILNCTyuzSYohzn7U9kkuQvBpKYsa/F4QjzV7fq7LeHknQr/tvkj1laJsNUazM7JoqxqgISQf6GGg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=l13yM9SMAsWdAEcPtu8PnnssPjDZgxRLjWhHIDkaDHNBN5t9dYyKfte3cVdyqaY9KNOmYh5uMVLgiSe514fhv31/JH44SGUMsmETKnuFsHbjZ3c8Q8hqFiFhZ38cc4blM2+Z6TB54tJM4ySuW083vHQu3SvmwI/ecIx4p0Y2nH1BopQQcbqH+13bNpBQ8GDz628a/NAcsvcMxPXfJV5JtQnGLTrpW8ibzXZnz09HQGsNamwVkPK2/8v1Sl6Lw/22aScKmesj/oB5QM/RNY37Gk8qVHmbx7d2BfAxNTN7yIR6Q7zm8VwJ6/92QATP74bcYXXOzgqpnKCnSkm+QDx3TQ==
  • Authentication-results: esa2.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Fri, 04 Feb 2022 09:23:26 +0000
  • Ironport-data: A9a23:WDWESai0PJQkmlQ3ptGHqQ7lX161/BcKZh0ujC45NGQN5FlHY01je htvWDvQPveIY2b0fo91aIq/9xlQ7ZTUndRkSABqpSlmEC0b9cadCdqndUqhZCn6wu8v7a5EA 2fyTvGacajYm1eF/k/F3oAMKRCQ7InQLlbGILes1htZGEk0GE/NtTo5w7Rj2tQw3YDja++wk YiaT/P3aQfNNwFcagr424rbwP+4lK2v0N+wlgVWicFj5DcypVFMZH4sDfjZw0/DaptVBoaHq 9Prl9lVyI97EyAFUbtJmp6jGqEDryW70QKm0hK6UID66vROS7BbPg/W+5PwZG8O4whlkeydx /1EpaKRUSArPZH1v80PaxhzPjM9NJxvreqvzXiX6aR/zmXDenrohf5vEFs3LcsT/eMf7WNmr KJCbmpXN1ba2rzwkOnTpupE36zPKOHxO4wSoDd4xCzxBvc6W5HTBa7N4Le02R9u3ZweQqyDP qL1bxJ3NxLdcxp+MG4qVrt5mseEgWbTQhZX/Qf9Sa0fvDGIkV0ZPKLWGMHOZtWASMFRn0CZj mHL5WL0BlcdLtP34SKM73aEluLJ2yThV+o6BLC+s/JnnlCX7mgSEwENE0u2p+GjjUyzUM4ZL FYbkgIsp6Uv8E2gTvHmQga15nWDu3Y0RN54A+A8rgaXxcL84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PEHP5Qr5OEtApTiBUJPwJk800aQFm7X5XI3SJzUO3VHHEGgM1/qB/9SNIVyaygcZ79 YcT0EcMqyPMbEZt7eC3ODQKb9Jq7PmgcOVbKXlvg9QpGlRGt5dBmxCe2Cm+yNNNW177c1TLu vh2iMLnUvpRV0nKuCAQlUVVenKoNPG0LrgfB49HhYirC2Dlymh5rLWGwWRmk52aUIE/Z4StU z+1yDp7KSqtP+2jjfaym/o9pxT3P/s0MFKCsCggtUcbh/slgGrToJ8XKDqhkF/nMifrHIR1P XcqRYpOMp+r1vXY2GOuBPonzLt1T4/gkWSvmOwsD/Gm4jUVTg6A81OicZyaR3C8Xctu9l6ze Ziw3+Zn4A/N2KOoA3No/zzEz16nEu9pnQv1cQJiWZEbIcYYLhN6aQC4UJuFosaFi6S0vFqLA BXNrCc2B9qSyLbU5iA1VMfg+BEH05DUytue3Jy9PB8iFNt7TJEJ0hx/r1qop5PzuN5d3B+3Z W1Dk1frsA6ciYnV9MNOA4/e7rFNoXse2O7DIvAGyWvKEk4U0i92aIfpo9FoN2XRA==
  • Ironport-sdr: I4YvK+rjXCOFrdxZ8+okPZpz9ihn/qJVkil6s1i2IO5hYWLcacMFNS9+OJT8P8bY3zu12/cwAG 93yBoP+YcCM4YpqIEmOf1/iCKNwbTd1rKXR390VjNglvGPTZhmBKf/gPDS2yxF5KaT0D/BJSy0 1PVAsMvsYwHckKcuUOrDAASinhYGXikO8NX9Mx11ZmcOJfVvXa2n7YM7Jfz2gtyyV/ocLZEYem C/Q/aiiOXt5lJZ9NkgVhUQ7GeDmr6LFpTIPcAOuyWh+1YV5IY5qedPQPh77A4snZlrC24Sw6v/ B1zVEHnpAb2ADY0gY8X/siF2
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Mon, Jan 24, 2022 at 02:47:58PM +0100, Jan Beulich wrote:
> On 20.01.2022 16:23, Roger Pau Monne wrote:
> > --- a/xen/arch/x86/include/asm/msi.h
> > +++ b/xen/arch/x86/include/asm/msi.h
> > @@ -54,6 +54,7 @@
> >  #define MSI_ADDR_DEST_ID_SHIFT             12
> >  #define     MSI_ADDR_DEST_ID_MASK          0x00ff000
> >  #define  MSI_ADDR_DEST_ID(dest)            (((dest) << 
> > MSI_ADDR_DEST_ID_SHIFT) & MSI_ADDR_DEST_ID_MASK)
> > +#define     MSI_ADDR_EXT_DEST_ID_MASK      0x0000fe0
> 
> Especially the immediately preceding macro now becomes kind of stale.

Hm, I'm not so sure about that. We could expand the macro to place the
high bits in dest at bits 11:4 of the resulting address. However that
macro (MSI_ADDR_DEST_ID) is only used by Xen to compose its own
messages, so until we add support for the hypervisor itself to use the
extended destination ID mode there's not much point in modifying the
macro IMO.

> 
> > --- a/xen/drivers/passthrough/x86/hvm.c
> > +++ b/xen/drivers/passthrough/x86/hvm.c
> > @@ -269,7 +269,7 @@ int pt_irq_create_bind(
> >      {
> >      case PT_IRQ_TYPE_MSI:
> >      {
> > -        uint8_t dest, delivery_mode;
> > +        unsigned int dest, delivery_mode;
> >          bool dest_mode;
> 
> If you touch delivery_mode's type, wouldn't that better become bool?
> 
> > --- a/xen/include/public/domctl.h
> > +++ b/xen/include/public/domctl.h
> > @@ -588,6 +588,7 @@ struct xen_domctl_bind_pt_irq {
> >  #define XEN_DOMCTL_VMSI_X86_DELIV_MASK   0x007000
> >  #define XEN_DOMCTL_VMSI_X86_TRIG_MASK    0x008000
> >  #define XEN_DOMCTL_VMSI_X86_UNMASKED     0x010000
> > +#define XEN_DOMCTL_VMSI_X86_EXT_DEST_ID_MASK 0xfe0000
> 
> I'm not convinced it is a good idea to limit the overall destination
> ID width to 15 bits here - at the interface level we could as well
> permit more bits right away; the implementation would reject too high
> a value, of course. Not only with this I further wonder whether the
> field shouldn't be unsplit while extending it. You won't get away
> without bumping XEN_DOMCTL_INTERFACE_VERSION anyway (unless it was
> bumped already for 4.17) since afaics the unused bits of this field
> previously weren't checked for being zero. We could easily have 8
> bits vector, 16 bits flags, and 32 bits destination ID in the struct.
> And there would then still be 8 unused bits (which from now on we
> ought to check for being zero).

So I've made gflags a 64bit field, used the high 32bits for the
destination ID, and the low ones for flags. I've left gvec as a
separate field in the struct, as I don't want to require a
modification to QEMU, just a rebuild against the updated headers will
be enough.

I've been wondering about this interface though
(xen_domctl_bind_pt_irq), and it would seem better to just pass the
raw MSI address and data fields from the guest and let Xen do the
decoding. This however is not trivial to do as we would need to keep
the previous interface anyway as it's used by QEMU. Maybe we could
have some kind of union between a pair of address and data fields and
a gflags one that would match the native layout, but as said not
trivial (and would require using anonymous unions which I'm not sure
are accepted even for domctls in the public headers).

Thanks, Roger.



 


Rackspace

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