Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25396C433E0 for ; Tue, 26 May 2020 17:58:01 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F128320776 for ; Tue, 26 May 2020 17:58:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F128320776 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jddpg-00033C-Un; Tue, 26 May 2020 17:57:44 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jddpf-000337-Qh for xen-devel@lists.xenproject.org; Tue, 26 May 2020 17:57:43 +0000 X-Inumbo-ID: 650e7ce6-9f7a-11ea-81bc-bc764e2007e4 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 650e7ce6-9f7a-11ea-81bc-bc764e2007e4; Tue, 26 May 2020 17:57:42 +0000 (UTC) Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: NjSlT6lCFbs4DsndjP2AVVVWYUbhekmkov3gNnsNRRqog9kA6FV7rTCzkPNduU+D82ECQIYEbm thbB9Yka+1OvqcN/hjPVEcs4I2pMp4/IG6Gfo+IlLahN2WX5GdPpoUt+7BdoXxkYm97zu0coLe PoCz2tekGqFt2GZkqP9f3jLOdugN4+0QOGIxLPI143bgDGiLDfBToeo6++nEiZPtHEpNMZZUju Ce/ueXEwn3Z90mkMzGwKA8erJIClHfBPOZYiRuwJ1IF2f19nEOyuXDwP3O1R2kGhkT7aq48Rfj Aj4= X-SBRS: 2.7 X-MesageID: 18775426 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.73,437,1583211600"; d="scan'208";a="18775426" Date: Tue, 26 May 2020 19:57:34 +0200 From: Roger Pau =?utf-8?B?TW9ubsOp?= To: Daniel Smith Subject: Re: [BUG] PVH ACPI XSDT table construction Message-ID: <20200526175734.GF38408@Air-de-Roger> References: <17251f968dd.b28c8ebe731955.2247348003729398828@apertussolutions.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <17251f968dd.b28c8ebe731955.2247348003729398828@apertussolutions.com> X-ClientProxiedBy: AMSPEX02CAS02.citrite.net (10.69.22.113) To AMSPEX02CL02.citrite.net (10.69.22.126) X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: xen-devel Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" On Tue, May 26, 2020 at 01:13:19PM -0400, Daniel Smith wrote: > Greetings, > > > > I was reviewing the ACPI construction for PVH and discovered what I believe is a flaw in the logic for selecting the XSDT tables. The current logic is, > > > > static bool __init pvh_acpi_xsdt_table_allowed(const char *sig, > >                                                unsigned long address, > >                                                unsigned long size) > > { > >     /* > >      * DSDT and FACS are pointed to from FADT and thus don't belong > >      * in XSDT. > >      */ > >     return (pvh_acpi_table_allowed(sig, address, size) && > >             strncmp(sig, ACPI_SIG_DSDT, ACPI_NAME_SIZE) && > >             strncmp(sig, ACPI_SIG_FACS, ACPI_NAME_SIZE)); > > } > > > > Unless I am mistaken, the boolean logic in the return statement will always return false resulting in an empty XSDT table. I believe based on the comment what was intended here was, > > > >     return (pvh_acpi_table_allowed(sig, address, size) && > >             !(strncmp(sig, ACPI_SIG_DSDT, ACPI_NAME_SIZE) || > >               strncmp(sig, ACPI_SIG_FACS, ACPI_NAME_SIZE))); Keep in mind that strncmp will return 0 if the signature matches, and hence doing this won't allow any table, as it would require a signature to match both the DSDT and the FACS one (you would require strncmp to return 0 in both cases). The code is correct AFAICT, as it won't add DSDT or FACS to the XSDT (because strncmp will return 0 in that case). Roger.