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

Re: [PATCH 1/2] x86/msi: passthrough all MSI-X vector ctrl writes to device model


  • To: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 15 Nov 2022 10:36:32 +0100
  • 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=yMwrRRmWSfJXnxj1Gshc70uBJANUspBSzid+TYEwV88=; b=M4Aguy0GPChlvJkt3tTG3kcIM1sRqGewb9WkuS77UlSwKhdecxVYilX2V8YQs+ddmkwS0+Ljrc3kn0lisCvqxf7VFTc2xCNcJzUrrmikp5V9MXujvHkANaJy6KhyFNE0ewyqnlaFxb6tM5+UWsCBNuo+NqqOwdIbOujf1ET5f/TFVT4T2hbBZtE5OI9Klj8UGZRS6dg74runOtV4jXuydhPhst+5rwX38yPp0pQr9HXNbv5tYA5Wqg9usF3XTr8ZwsAeWShq0fomsQysIo8kpHUTaLvAMa6qhq+IW1QQ+e3BGZ2YTBiwrHRA2lz9fqnFoTw2KMcaiR77CpnBMUX/kQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FAY3T2oPEogvFz96X0sA/uMDtqngOyuI+RlonT/rwe+lBTowyvblUnURvoEC0w4IevQyIw7usXm9n6F8QBCd52PJAHLUuKNxBHJhB76j7jwAqw4Vky2ZC4yJBLz9CGs2q2ZUvmh4u7eM12YPW8TDgBLnONEhDWnMy4eBgGh+/c5oRLvNKrxQeZRh1cL5o/MpgGTkmdtsBAX1WIWg4NA6mh5JFnXuCDgDMZwsgN/ZOQuX7jc3KISwUyC+W+spCEQ3P5cbWFQP6ZuZ6j19HioSWukPpqB6rIsVrLnmKid2+XKOLXpiqmbxYaKMBz0igQ12Dc04zXIfS/RSjrC1GUZ4TA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Tue, 15 Nov 2022 09:36:39 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 14.11.2022 20:20, Marek Marczykowski-Górecki wrote:
> QEMU needs to know whether clearing maskbit of a vector is really
> clearing, or was already cleared before. Currently Xen sends only
> clearing that bit to the device model, but not setting it, so QEMU
> cannot detect it.

Except for qword writes as it looks. Furthermore even clearing
requests aren't sent if address/data are unchanged. If you agree,
please add this here in some form for having a complete picture.

> Because of that, QEMU is working this around by
> checking via /dev/mem, but that isn't the proper approach.
> 
> Give all necessary information to QEMU by passing all ctrl writes,
> including masking a vector.

Can we perhaps still avoid sending dword writes which don't change
the mask bit?

> --- a/xen/arch/x86/hvm/vmsi.c
> +++ b/xen/arch/x86/hvm/vmsi.c
> @@ -271,7 +271,8 @@ out:
>  }
>  
>  static int msixtbl_write(struct vcpu *v, unsigned long address,
> -                         unsigned int len, unsigned long val)
> +                         unsigned int len, unsigned long val,
> +                         bool completion)
>  {

I'd like to propose an alternative approach without an extra parameter:
Have msix_write_completion() pass 0 for "len" and move the initial
check

    if ( (len != 4 && len != 8) || (address & (len - 1)) )
        return r;

into _msixtbl_write(). Then ...

> @@ -343,7 +344,7 @@ static int msixtbl_write(struct vcpu *v, unsigned long 
> address,
>  
>  unlock:
>      spin_unlock_irqrestore(&desc->lock, flags);
> -    if ( len == 4 )
> +    if ( len == 4 && completion )
>          r = X86EMUL_OKAY;

... this could simply be "if ( !len )", seeing that even with your
approach it could simply be "if ( completion )".

Jan



 


Rackspace

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