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

Re: [PATCH] Fix PCI hotplug AML


  • To: paul@xxxxxxx
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 20 Mar 2023 11:34:39 +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=TNzBbkB/3KzNTkAWKVBtvGjPS9XdsvspU5p6u38zjf8=; b=DgdPjrfcoB2QPny3O87ek8GizOGNkwAfJdvIXj4vdsC53GGscJHPRxDDeUziu5Lcyqh7cBD3i3IDIBPES/Tt94Z2DfYy5Hu814HFg/bV2aCM9UKoHhcKcXBJeDxlozHYNrmMs8AvXhVc0+Kd77m22yZiEvNUEifMrx3904JyfgLjgHKTANitBh/akaHS9LBakFxF41Yw3buQhPDTE+S/yhpQ6DhAv4kBBxmyrFM+Na2B9PpX0h0wZJJihdoPih0FIGG7jxvGJP2ZQI3lJ4faIZ+kzhS+2U8t92xV4J3YI2Tn3+cUM4ibL3sBAEbFfWvy4yD77kBMDGiw/MZjiAOzyw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W1lgmkZ4rWTg/5xx8HTKfYLFAsOItupFOwHZCYDcRTS0R8dKrBQM+yasNKgg/xlkQIuQpqqkM98j1bjozYLWLlB0KEAuWa6kU7Bw/5ui6kY+jsECi8hBRa4mRyDScg9/UQ+BZQn//VTVu/2e3j1OrZ609hPqjtfQyAIVGGIdP/Xd9KrREyq+Qkf+EvuX+f5Ijen1aBAOPbI84k4WLjiP9geMyDPs7weWsx3DiA9T7/QcRr8oDD8z5rgAmhzjdo5emyjq47u2Zcv5EZTcbPud6U66aVNXmW68Ir5MuJBislog0mDS0AOLUPCNea5//9N7SA70IUcldGJfzeLlVvsMlw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: David Woodhouse <dwmw2@xxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 20 Mar 2023 10:34:56 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 20.03.2023 10:04, Paul Durrant wrote:
> On 17/03/2023 10: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")
>> ---
>> Utterly untested in Xen. Tested the same change in a different
>> environment which is using precisely the *same* AML for guest
>> compatibility.
>>
> 
> This AML only relates to the hotplug controller for qemu-trad so it's 
> unlikely anyone particularly cares any more. In fact I'm kind of 
> surprised the generation code still exists.

Why would it not exist anymore? Use of qemu-trad is deprecated and
advised against, but it's still possible to use it. Otherwise quite a
bit of cleanup in libxl could also happen, for example.

Jan



 


Rackspace

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