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

Re: [PATCH] Fix PCI hotplug AML


  • To: David Woodhouse <dwmw2@xxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 20 Mar 2023 11:32:38 +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=mjrbQCcdzE4w9Xt0BVsOKXbZKykxAv0KbAu9N+r4Fnc=; b=EPW4F3aARDvD4Foy0UrVxaI/gJcvbim7hJMJZZBvd82f2SZdmQ0XNJGKZQ6EQo1NlyNbsqxOS9y9cRpuKYvEdhGRCKziwFUC4dloHaeutft1hnqX2v3qiwulArMfw7KFNkS5hzG5hk8JwOq/SviETlZIqVj3KBWQhHGUeQO9NHwYCELqXEbW2YoX1Z9Y2mbWpazg8im5SCylznJ22PnGl7DdXWLVKGv1PNckPUXvGd7pLQ+jlpqZ5tBUwBAH5NPm3LZvejeFI2xWe15NW4SK5fKYBMQuZWds2yigPRi0AbUA70+PWZPQQcBUDRdxvUEhDOmUFgai+KiZYJCF5/Gk4Q==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AddAW00jjwrK3ufwzFVcnx+jLpo2+L/odKY3BYJYkos4PltP1TrYLleG1R7lZzwJ+1dRlULvX1F7ZAs/8PoRqf6ke1Gyv+9oiWQHfGFZM6JjVeBuhqgMfmkxR/B/8wim6vKtDlzl7Zjk8ML4z9TFLixLWVCD38oY8zAp+S3WKWa+8kUsU3yUTqyoWmMYfdNKqerxyUjmWp/ym4HWxeWdy/ah7kuUeTclfrSgNuK78gljjr6+rPOkoCGhM/EJ3xlpEotbzyA1bRnYoUJZdo6P6RkbQh/lamrfMcV09Jv1lyU4g6L85SWMPEKSki34ar7w+fYpA8Yr5Jk6kV2Iv2HgKQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Paul Durrant <paul@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 20 Mar 2023 10:32:42 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 17.03.2023 11:32, David Woodhouse wrote:
> From: David Woodhouse <dwmw@xxxxxxxxxxxx>
> 
> The emulated PIIX3 uses a nybble for the status of each PCI function,
> so the status for e.g. slot 0 functions 0 and 1 respectively can be
> read as (\_GPE.PH00 & 0x0F), and (\_GPE.PH00 >> 0x04).
> 
> The AML that Xen gives to a guest gets the operand order for the odd-
> numbered functions the wrong way round, returning (0x04 >> \_GPE.PH00)
> instead.
> 
> As far as I can tell, this was the wrong way round in Xen from the
> moment that PCI hotplug was first introduced in commit 83d82e6f35a8:
> 
> +                    ShiftRight (0x4, \_GPE.PH00, Local1)
> +                    Return (Local1) /* IN status as the _STA */
> 
> Or maybe there's bizarre AML operand ordering going on there, like
> Intel's wrong-way-round assembler, and it only broke later when it was
> changed to being generated?
> 
> Either way, it's definitely wrong now, and instrumenting a Linux guest
> shows that it correctly sees _STA being 0x00 in function 0 of an empty
> slot, but then the loop in acpiphp_glue.c::get_slot_status() goes on to
> look at function 1 and sees that _STA evaluates to 0x04. Thus reporting
> an adapter is present in every slot in /sys/bus/pci/slots/*
> 
> Quite why Linux wants to look for function 1 being physically present
> when function 0 isn't... I don't want to think about right now.
> 
> Signed-off-by: David Woodhouse <dwmw@xxxxxxxxxxxx>
> Fixes: 83d82e6f35a8 ("hvmloader: pass-through: multi-function PCI hot-plug")

Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>





 


Rackspace

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