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

Re: [PATCH v5] x86: detect CMOS aliasing on ports other than 0x70/0x71


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 3 Apr 2023 14:24:37 +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=p163uZDvV5ZjP7boHQvWgvCYdt+czz0NqgkwcVWTlAY=; b=FBGq86CwJCpX74g1kpGzX6VtTkqWbjHkvSa9d8sEDVewsmuzYyXYApYByPAdvB8QysZ7DYmspR2B45qlntTffbEY7f2liRwsoWYZk7sAWqqGi1yae7fzXEj+WX6KKcc9aBuUOYQ7vE8+P0FJmAvO7iq2i56QdD4W1BLkc1GJqoRxHQNwBK9WENPUIBMXstDPI89vXnzfZQPEUwSHE2we6hLWR1WLMBEXOn0LtMqe/PU+tGVpUvdETqqYJtg+xCcJMBH6ptkJezI6+IKqj8otF8+bJ8wHDjSIr05eb2BVrJ6+xEFBEO8AHDg0BMtODxGSdQM34vag7/NZpuzrmySR2w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MFyhteW20r1iypmuiWClHRYR88XwsXiDbigY9APD1HbqI+7m1IM3m007KbvNZFprUN5UlgUJu59vamO6+c5HprTjANiKvCKv0oBBQ5iooIaRKJkTul64Wp5y7TjVBYj7her6Kd74Vr/17ryQ3zW52fXHgdQRcyQHSzpuacYg8+6u0w2aE1bouDX7DDQfR+8iHoZYHZSLDzjOecXg7SFBUYn8NVCYxLVVHBDS1L7mv21bTurQTaQLXR28bNwB1E8btqmztAu4VM75njArB4/V3SKR43nKlE8bi1hgP2sX4upmhsrMgc5v3L37+Y3QYLqBWdKH/MurXbyltFvEOvOVTw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Paul Durrant <paul@xxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Mon, 03 Apr 2023 12:24:51 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 03.04.2023 13:44, Roger Pau Monné wrote:
> On Mon, Apr 03, 2023 at 01:26:41PM +0200, Jan Beulich wrote:
>> On 03.04.2023 13:09, Roger Pau Monné wrote:
>>> On Thu, Mar 30, 2023 at 12:40:38PM +0200, Jan Beulich wrote:
>>>> +bool is_cmos_port(unsigned int port, unsigned int bytes, const struct 
>>>> domain *d)
>>>> +{
>>>> +    unsigned int offs;
>>>> +
>>>> +    if ( !is_hardware_domain(d) ||
>>>> +         !(acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_CMOS_RTC) )
>>>> +        return port <= RTC_PORT(1) && port + bytes > RTC_PORT(0);
>>>> +
>>>> +    if ( acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_CMOS_RTC )
>>>> +        return false;
>>>> +
>>>> +    for ( offs = 2; offs <= cmos_alias_mask; offs <<= 1 )
>>>> +    {
>>>> +        if ( !(offs & cmos_alias_mask) )
>>>> +            continue;
>>>> +        if ( port <= RTC_PORT(offs | 1) && port + bytes > RTC_PORT(offs) )
>>>> +            return true;
>>>> +    }
>>>
>>> Maybe I'm confused, but doesn't this loop start at RTC_PORT(2), and
>>> hence you need to check for the RTC_PORT(0,1) pair outside of the
>>> loop?
>>
>> The loop starts at offset 2, yes, but see the initial if() in the
>> function. Or at least I thought I got that right, but it looks like
>> I didn't (failed attempt to try to address a specific request of
>> yours, iirc).
> 
> Hm, doesn't that first if() cause that on all systems with an RTC only
> PORTS(0,1) are allowed?

Indeed, hence why I said "failed attempt". Looking at it now I really
don't know what I was thinking when writing it that way.

Jan



 


Rackspace

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