Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp131285iob; Tue, 17 May 2022 21:16:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/IOuOIfTzVqFFImDDupSUaWyY6x17LgfXLKatKCPp1FSn6gNtAYrjOEzoIsk9YpxQHHLN X-Received: by 2002:a17:902:7144:b0:15f:3d88:d79 with SMTP id u4-20020a170902714400b0015f3d880d79mr25600075plm.86.1652847408708; Tue, 17 May 2022 21:16:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652847408; cv=none; d=google.com; s=arc-20160816; b=O42VEgtpRCEPO3rSfi12luRQacRQtvx0tUctB9fcoUT1F2IB6iIoIVM3eAKZSC4tYV fEZh49nFTfxEJddYdmSRNqWL4w+nmHN+6ZBBSjxXCW0AniT2i1l0mQgeJfZ3kqJH6a3H 0WvRfwA/H2Cn2At9WPd0hnI8k8Bo51GwMjeA7AZlqAIwsreAKLwJlX/1IUwJ/ZzlHD5x EpozTEwbGh7BB5IA0g0s1WQjwH4M4KJ4QUBogMV/tf1FyGh87uCCYSxmun1RetZV3ez0 Gt64JcI5SagmtNPHH6tFOWxzyT4h9xhCAvGeQan0biLL6i/Lf6OrIVHy/RYDes65JkJ2 3KWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=sVf0IKcUPJN+ZbeQbmcYThh8l5zqk/JygO3ZKJiiVYo=; b=hHnVC+s1q0h2cYF7wKBumjlVJh1CjACqP7ZdxwdqxN2cCCPb60N/PbyyQS5RqaS62w cHSQQC9LvrBaS/A2I6OH20b5CD16faS+T89xD52uwoYNjPEycgTgeMP4CZYLPOJJaLMi ZAfbEiSeNO84XAxQlHEiTSuW+dzTldFapbTk6zHSYPUBpjxTQl4YUgrfRSIwnyshiZ0s 5DoaktVAA0lu4X714bzzmqmc5QQMei1uMcJjNw90V0o2e/aQrkPxEuCVu0Z94H8UcmF+ G5Tf1BZNGrgQpOIt2hOgIfc+tB3vtAVYeWOpsgSr+e+84Zi2g4478qJj6fIE/YOm6+k3 WotA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id h5-20020a63df45000000b003c6bf873abesi1210622pgj.73.2022.05.17.21.16.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 21:16:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 864F69E9CA; Tue, 17 May 2022 20:45:33 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352164AbiEQS01 (ORCPT + 99 others); Tue, 17 May 2022 14:26:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352086AbiEQS0K (ORCPT ); Tue, 17 May 2022 14:26:10 -0400 Received: from mail-yw1-f180.google.com (mail-yw1-f180.google.com [209.85.128.180]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD57F21267; Tue, 17 May 2022 11:26:07 -0700 (PDT) Received: by mail-yw1-f180.google.com with SMTP id 00721157ae682-2ff1ed64f82so182427b3.1; Tue, 17 May 2022 11:26:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=sVf0IKcUPJN+ZbeQbmcYThh8l5zqk/JygO3ZKJiiVYo=; b=ryn+siO6zNNuvQL83d348CgtLI6ZAzdwa4HT6yKeeLQJMOERs9JFKDYgXVnUiY4Hko IjxsqxC/9pXtG9Wv3RmRlEsFy3LzEeIhrBqaf5zd8RmUgj4gHGucKKazpqY9uoAjb0PQ GnnYuTRIdTOWcpCk8yRCre8N6hfogM6tUoB4giD0Pl8DWfapXFHREmqdTfPKm/+QbwKE yXFmAQkG08Tvtwt4pjAfwXD2k1hbr9B2CLtzZh9qsuUTGnHQ5sFfSzMd6gOb9KDxosGc lfUzPHy83WUr9pu8ghAyuNUHS3CwM1pbFCvsitBtXpPamovlMSR9Tmq3CLjVeJDnm07Z W9yQ== X-Gm-Message-State: AOAM530/iF6/aQaQChesU5u+Gu9Qn2VjhLd+LjNjRhYO6bUYaKfFM1Jk MIGqOS9PkpSlLToloU5pVXx6f2Cyp1hzjykvW/x7UJGg X-Received: by 2002:a0d:c442:0:b0:2fe:beab:1fef with SMTP id g63-20020a0dc442000000b002febeab1fefmr24061021ywd.196.1652811966272; Tue, 17 May 2022 11:26:06 -0700 (PDT) MIME-Version: 1.0 References: <20220401172840.1252-1-james.liu@hpe.com> <20220517175629.GA4788@ubuntu-20.04.3> In-Reply-To: <20220517175629.GA4788@ubuntu-20.04.3> From: "Rafael J. Wysocki" Date: Tue, 17 May 2022 20:25:55 +0200 Message-ID: Subject: Re: [PATCH] ACPI: OSL: Fix the memory mapping of an ACPI GAS that addresses a data structure To: James Liu Cc: "Rafael J. Wysocki" , Len Brown , ACPI Devel Maling List , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 17, 2022 at 7:56 PM James Liu wrote: > > Hi Rafael and all, > Could you take a look into this patches? The mentioned bug blocks EINJ > testing whenever a system firmware can correctly support GAS according > to ACPI 6.4. The kernel test robot reported an issue with it. Have you seen that report? > On Fri, Apr 01, 2022 at 05:28:40PM +0000, james.liu@hpe.com wrote: > > From: James Liu > > > > Modify acpi_os_map_generic_address and acpi_os_unmap_generic_address > > to handle a case that a GAS table (i.e., Table 5.1 in ACPI 6.4) is used > > to address a data structure; in this case, the GAS has the field of > > "Register Bit Width" equal to 0. > > > > For example, "Injection Instruction Entry" (Table 18.25 in ACPI 6.4) > > has a RegisterRegion field that is a GAS that points to a data > > structure SET_ERROR_TYPE_WITH_ADDRESS (Table 18.30), which is required > > when using EINJ (Error Injection module). > > > > This fix preserves a fairly sufficient memory space (i.e., page size) > > to store the data structure so as to prevent EINJ module from loading > > failure if platform firmware can support Injection Instruction Entry in > > an EINJ table. > > > > Signed-off-by: James Liu > > --- > > drivers/acpi/osl.c | 23 +++++++++++++++++++++-- > > 1 file changed, 21 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c > > index 45c5c0e45..ab2f584b1 100644 > > --- a/drivers/acpi/osl.c > > +++ b/drivers/acpi/osl.c > > @@ -457,9 +457,15 @@ void __iomem *acpi_os_map_generic_address(struct acpi_generic_address *gas) > > if (gas->space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) > > return NULL; > > > > + /* Handle a case that GAS is used to address an ACPI data structure */ > > + if (!gas->bit_width) { > > + pr_info("An ACPI data structure at 0x%llx is mapped\n", addr); > > + return acpi_os_map_iomem(addr, PAGE_SIZE); > > + } > > + > > /* Handle possible alignment issues */ > > memcpy(&addr, &gas->address, sizeof(addr)); > > - if (!addr || !gas->bit_width) > > + if (!addr) > > return NULL; > > > > return acpi_os_map_iomem(addr, gas->bit_width / 8); > > @@ -474,9 +480,22 @@ void acpi_os_unmap_generic_address(struct acpi_generic_address *gas) > > if (gas->space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) > > return; > > > > + /* Handle a case that GAS is used to address an ACPI data structure */ > > + if (!gas->bit_width) { > > + pr_info("An ACPI data structure at 0x%llx is unmapped\n", addr); > > + mutex_lock(&acpi_ioremap_lock); > > + map = acpi_map_lookup(addr, PAGE_SIZE); > > + if (!map) { > > + mutex_unlock(&acpi_ioremap_lock); > > + return; > > + } > > + acpi_os_drop_map_ref(map); > > + mutex_unlock(&acpi_ioremap_lock); > > + } > > + > > /* Handle possible alignment issues */ > > memcpy(&addr, &gas->address, sizeof(addr)); > > - if (!addr || !gas->bit_width) > > + if (!addr) > > return; > > > > mutex_lock(&acpi_ioremap_lock); > > -- > > 2.25.1 > >