[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: Rahul Singh <Rahul.Singh@xxxxxxx>
  • From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Date: Thu, 16 Dec 2021 12:01:53 +0100
  • 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=RWiGSycncAROXKRaDPiBtui2T+NsU8mFODxhu+cqg/E=; b=NwpEH9mPoE+nETjstaIEWqr8VN7OFm1apoGpvdxKQExiDsVEYRM+xG4r3USbAyks95t846SI9XH2fjMKJDvoyQU7RmxvI3PxocUFnIG8r7mpYz8sJtb9TiMfe922pf9i4Vqyq20vGZxL7ThlgQc7IJaomPubtotiG8VJU51lvoO8PFIVNc8wOmE/JXEzpA0vozG3ag+yKiKbtg7I5p6hBP+/UeFrVg6z6XBPK6pax+X6TZQ8XDXfR664fpecFfEdS38o+IixCeLBFc+6ogB7rXJkfgK5tqXoul1+s+NS0CnEaMzBdXQI+OTwOngoswh3u+5rfYAukAmGFCyA2RJuqA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=InrnOGRyhI4ELYPL8hYZZroLnBuxwhHv7H4U0aRyGHiNQL4A/n3FExI2ZkdYDi1q6YMQOf69ngDTqwug2FMUDrYg/h5kjHLETMBghkMv1MC86kVAADksL0K7/he2cdm6pzJ9WEAxljmK1slNtdNkIjtzASsIDKo+ayr1LekNpt4yQIdcOfN+adDK9E8OEMIxBcam+atQpqj6V+CkoCyPFgvTFO8I7l6hg8v8jTkHZB1YL2lNjAeG1ywMVgcxMviduKbZon/o877lBfHK6Wc5hSJzlIYoHT3+1RR5CwcJeVx1OQsXBzeBQ8vnqcwHUIrYEr0mO0nvw0DkL9pg4gqgIg==
  • Authentication-results: esa3.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, 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 11:02:29 +0000
  • Ironport-data: A9a23:67Af4KzWNeCzVoK+EfZ6t+eDwSrEfRIJ4+MujC+fZmUNrF6WrkUGm GdOXGCPMv6KMGP1coh2aI6+9B9T75Lcyt82TwQ+ryAxQypGp/SeCIXCJC8cHc8zwu4v7q5Dx 59DAjUVBJlsFhcwnvopW1TYhSEUOZugH9IQM8aZfHAhLeNYYH1500s6wbdn2tQAbeWRWGthh /uj+6UzB3f9s9JEGjp8B3Wr8U4HUFza4Vv0j3RmDRx5lAa2e0o9VfrzEZqZPXrgKrS4K8bhL wr1IBNVyUuCl/slIovNfr8W6STmSJaKVeSFoiI+t6RPHnGuD8H9u0o2HKN0VKtZt9mGt/tqj 49jibyVdRUGGbPNqOI+FElpEBgraMWq+JefSZS+mcmazkmAeHrw2fR+SkoxOOX0+M4uXzsIr 6ZBbmlQMFbT3Ipaw5riIgVort4kI8TxepsWp1lrzC3DDOZgSpfGK0nPzYEAhWhg358fdRrYT /Q0MGR+fTn4XxBWGmcsEMMR3/+vt2aqJlW0r3rK/PFqsgA/1jdZz7zFINfTPNuQSq19nFucp 2/A13T0BFcdLtP34SGe7numi+vLnCX6cIEfDru18rhtml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207PU3svDnycj+NSiKMHtA1O0FJfdU+CncDIh6Nv0RBcmdjtot+5EvmTPzpPB 1VW
  • Ironport-hdrordr: A9a23:+LcxyKOYb7suu8BcT1v155DYdb4zR+YMi2TDiHoedfUFSKOlfp 6V8MjztSWVtN4QMEtQ/+xoHJPwPE80kqQFnbX5XI3SJjUO3VHIEGgM1/qG/9SNIVybygcZ79 YeT0EcMqyBMbEZt7eD3ODQKb9Jq7PrgcPY59s2jU0dNj2CA5sQnjuRYTzra3GeKjM2YqbQQ/ Gnl7R6TnebCD4qR/X+IkNAc/nIptXNmp6jSRkaByQ/4A3LqT+z8rb1HzWRwx9bClp0sPsf2F mAtza8yrSosvm9xBOZ/2jP765OkN+k7tdYHsSDhuUcNz2poAe1Y4ZKXaGEoVkO0aySwWdvtO OJjwYrPsx15X+UVmapoSH10w2l6zoq42+K8y7QvVLT5ejCAB4qActIgoxUNjHD7VA7gd162K VXm0qEqpt+F3r77WXAzumNcysvulu/oHIkn+JWpWdYS5EiZLhYqpFa1F9JEa0HADnx5OkcYa dT5fnnlbVrmG6hHjLkVjEF+q3oYp1zJGbIfqE6gL3U79AM90oJi3fxx6Qk7wE9HdwGOt55Dt //Q9ZVfYd1P7grhJJGdZQ8qPSMexnwqDL3QSqvyAfcZeo600ykke+C3Fxy3pDtRKA1
  • Ironport-sdr: iy+1pHLQXsSOFkeJ7lx+DgCGH3Wcuu6jzTTUmkkv/HCKvziH0qvV+x4Cfreljdo1rf0HHVKeaU y8wvQi8dUQhJLSQIsVvMg0fS8oC999B6fjEcC+gRXQgwcE6ja+tt60qGxDhr4Z+Yq4hRTXWsB6 fxkJnFy3/jEjSEDzMMn6bOSS6XufhIPAv/FtkwX1lq5T5U9iVOo0KSC9BDnLa5hLr9E1SFxrRI NPAAIJLcfej2LacaWWp58bi08x/799Q0KtWQ8L997/xfbYgaoyRxC9OLb9aWC4MlQogAWvfs32 C69GQJ7xpXvKBofUVx9Pzgi3
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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.

Thanks, Roger.



 


Rackspace

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