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

Re: [PATCH] x86/pci: Correct ECS handling with CF8/CFC emulation


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 4 Apr 2023 17:18:13 +0200
  • 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=62XBXfVTI7hx6DBhJHmeGCLANXJLmjSM/SQCiMNAh4c=; b=cFAfsyS/MGqAxLJA36bCHNzpJPzPCqH+h3Dshoe5g1k4LZD8TtvxGRrI0QTukKcVw8/89xH2ipkF0sLXlphewf8bvTp0FO1tdCCiEiNXPC4ZvwuIrwTHUD8jgEaB8vXmbpXjJdHTQ9y6UeH7biwwMWkopwzolWHZipzhbdiyldZU/pps4g2z2eY+JVqnJeFRx4kbU36n5qB/RcxDvZxSVkxVAjYyyn3QVnSgBffxUq2/ZfXZdOAwYUYNSK7Br6HcT+OVtKyIl1P81Zw5OJrm89QpQ7uftFrtlzzW50QkCufAGgg4zsRv+p9dX2PfKjdcY4GnNZ4DofHIflK8PewI9A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Qge5t21hXJyEHRkcmOzMh/XI4LOHNFeIm9xUWwrxOF1dGcLWyZOBfyaEQiEd88Et0rV6/ZC6wE5bcvRc2W6cqvL/JIWE9AMNznlTFOu6GR1aPbMCQb1UxWWzjRTBMVIRuYpob/IJyS1pYqsmdHQm3CRsPHUNS+s5KmgLUa1+LnBLny7RaQb40AArkhfAPMfvj4DEN3xl5xsEIcoBXj55D8pUOax2zv9eQKGWPL/t6OiAZQmi5l9FTlITBRcRWrHKvgQi+5mXHtt68/pctR52Qvz5aBw5kNr8oWcF13nzCIPCFBmKBI3Dx0V4wlUbCMyX+m85kj5mXGmuH8OJMsivIg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Delivery-date: Tue, 04 Apr 2023 15:18:29 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 04.04.2023 17:04, Roger Pau Monné wrote:
> On Tue, Apr 04, 2023 at 02:27:36PM +0100, Andrew Cooper wrote:
>> On 03/04/2023 2:26 pm, Roger Pau Monné wrote:
>>> On Mon, Apr 03, 2023 at 11:16:52AM +0100, Andrew Cooper wrote:
>>>> On 03/04/2023 9:57 am, Roger Pau Monné wrote:
>>>>>> @@ -1104,6 +1092,11 @@ static int cf_check write_msr(
>>>>>>          if ( !is_hwdom_pinned_vcpu(curr) )
>>>>>>              return X86EMUL_OKAY;
>>>>>>          if ( (rdmsr_safe(MSR_AMD64_NB_CFG, temp) != 0) ||
>>>>>> +             /*
>>>>>> +              * TODO: this is broken.  What happens when dom0 is pinned 
>>>>>> but
>>>>>> +              * can't see the full system?  CF8_EXT probably ought to 
>>>>>> be a
>>>>>> +              * Xen-owned setting, and made symmetric across the system.
>>>>>> +              */
>>>>> I would assume CF8_EXT would be symmetric across the system, specially
>>>>> given that it seems to be phased out and only used in older AMD
>>>>> families that where all symmetric?
>>>> The CF8_EXT bit has been phased out.  The IO ECS functionality still 
>>>> exists.
>>>>
>>>> But yes, the more I think about letting dom0 play with this, the more I
>>>> think it is a fundamentally broken idea...  I bet it was from the very
>>>> early AMD Fam10h days where dom0 knew how to turn it on, and Xen was
>>>> trying to pretend it didn't have to touch any PCI devices.
>>> It seems to me Xen should set CF8_EXT on all threads (when available)
>>> and expose it to dom0, so that accesses using pci_{conf,write}_read()
>>> work as expected?
>>
>> It's per northbridge in the system, not per thread.  Hence needing the
>> spinlock protecting the CF8/CFC IO port pair access, and why MMCFG is
>> strictly preferable.
> 
> So just setting CF8_EXT_ENABLE on MSR_AMD64_NB_CFG by the BSP should
> be enough to have it enabled?  I expect all other threads will see the
> bit as set in the MSR then.

No, it's one bit per socket iirc.

Jan



 


Rackspace

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