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

Re: [PATCH] xen/vpci: msix: move x86 specific code to x86 file


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>, Rahul Singh <Rahul.Singh@xxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 16 Dec 2021 14:37:02 +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=qT7xr7hdGE4XxBPRqmeo2STYje58FlwKMlEugnsgRpE=; b=nvrhnWjO9/7a3y+2BHHhLQs9yDa3drsvjInY49gEE/AHRlmGTc3TwwmS+IWSJyvhSBOI6OAxkOP/TYz26mYkM1fzop+UyxTq3f5jtA4xJil6XxBB6MR6Kye7LSahmRa0U7e14V7FIyaCxSD7FWdl0kNIZyeifwztAxZ34VrMyng3tO384oMXaV/NvgnrFLVlp2GUFzkCI+uVckQHKsTe6YL0cZDbiAJ5kJKQX03IUApkUjc2Ju0DIEU9xBJccSknA8yR8uI24GqMSjUDrD9NdG6zl1eYFk84p0ucW1C1U1Zjv3PSCR/o8WElXN27qa91trTl99GVwRsH7z9H2vi6gQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MACzCuYsFnXM6L7WpKa6uDN5Gw/Hy/F2d8V70QlFHWgytLFFJIRYpn9WioaLp1jy7oBA+fpbyDXaX/Gu4ary7OR6CghsnX4ECJavsoefimHy6h40Sqgv6TVazx8RcB3q70aJL2DiMMzXp8gnAylJR8X0mO3mzvK136TTgev5UB7MjClTkTiiWrDfTxcFzqWI5lXoDkLQo9qNkLiAB0yRdVO7jbNqIOwfBLmbP3yMo7TjBkMPJHbjd+jbSE7NW+Qftj+uFGyLGeGOeJ9lOvlDEX7sn5DqXoXs7S8NqylnnZZA9dT3+aprj2jT2EHJfjtj0wRDKsj9I/YZP9r0j1VPHg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • Delivery-date: Thu, 16 Dec 2021 13:37:42 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 16.12.2021 12:01, Roger Pau Monné wrote:
> On Thu, Dec 16, 2021 at 10:18:32AM +0000, Rahul Singh wrote:
>> Hi Roger,
>>
>> Thanks for reviewing the code.
>>
>>> On 14 Dec 2021, at 12:37 pm, Roger Pau Monné <roger.pau@xxxxxxxxxx> wrote:
>>>
>>> On Tue, Dec 14, 2021 at 10:45:17AM +0000, Rahul Singh wrote:
>>>> +              unsigned long *data)
>>>> {
>>>> -    const struct domain *d = v->domain;
>>>> -    struct vpci_msix *msix = msix_find(d, addr);
>>>>     const struct vpci_msix_entry *entry;
>>>>     unsigned int offset;
>>>>
>>>>     *data = ~0ul;
>>>>
>>>>     if ( !msix )
>>>> -        return X86EMUL_RETRY;
>>>> +        return VPCI_EMUL_RETRY;
>>>>
>>>>     if ( !access_allowed(msix->pdev, addr, len) )
>>>> -        return X86EMUL_OKAY;
>>>> +        return VPCI_EMUL_OKAY;
>>>>
>>>>     if ( VMSIX_ADDR_IN_RANGE(addr, msix->pdev->vpci, VPCI_MSIX_PBA) )
>>>>     {
>>>> @@ -210,11 +194,11 @@ static int msix_read(struct vcpu *v, unsigned long 
>>>> addr, unsigned int len,
>>>>         switch ( len )
>>>>         {
>>>>         case 4:
>>>> -            *data = readl(addr);
>>>> +            *data = vpci_arch_readl(addr);
>>>
>>> Why do you need a vpci wrapper around the read/write handlers? AFAICT
>>> arm64 also has {read,write}{l,q}. And you likely want to protect the
>>> 64bit read with CONFIG_64BIT if this code is to be made available to
>>> arm32.
>>
>> I need the wrapper because {read,write}{l,q} function argument is different 
>> for ARM and x86.
>> ARM {read,wrie}(l,q}  function argument is pointer to the address whereas 
>> X86  {read,wrie}(l,q} 
>> function argument is address itself.
> 
> Oh, that's a shame. I don't think there's a need to tag those helpers
> with the vpci_ prefix though. Could we maybe introduce
> bus_{read,write}{b,w,l,q} helpers that take the same parameters on all
> arches?
> 
> It would be even better to fix the current ones so they take the same
> parameters on x86 and Arm, but that would mean changing all the call
> places in one of the arches.

Yet still: +1 for removing the extra level of indirection. Imo these
trivial helpers should never have diverged between arches; I have
always been under the impression that on Linux they can be used by
arch-independent code (or else drivers would be quite hard to write).

Jan




 


Rackspace

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