Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp4480135pxt; Wed, 11 Aug 2021 07:04:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwt33GaeICjHGV4RkPv1O2VsksATvm2j7uiRnvE9Cq3zvo/JKt9RmGUUA5QwLiQ7RogYlrq X-Received: by 2002:a05:6602:2dc8:: with SMTP id l8mr7275iow.179.1628690689011; Wed, 11 Aug 2021 07:04:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628690689; cv=none; d=google.com; s=arc-20160816; b=u1ETQzlfEE7K1nFaqS/PdSczwt9Cd1L8qEfKyIBfhnETk/qJEhRsfC0itO1j70iaeo iuWyT6Fej5ogBIUTp30XqH3VIFJII6LPyxBRsdlpK/c9J/uLX0Nohwon2yJpD/0qTzLu aS/1pJ6LA8YyH8sCnZjNvaShTaI0f2aSFvljddG0nCYv+vOq9j9M6/3bcZ99TGnMomaL BtVUr24oPQOIdlJAUMfVQGckRtdvPOnTBU+P7VqX/1hULaKISJZzX8nuRIcCBpBFHX0t YAygIenaz8Y/eC/gntehsWceAZFWJsP95CItz48kuwd5RlFVrOViREZZHv6JzRZt+0hN LqHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=DSc2a3x9oPrncFpDHt6ftkQNCfkK2dpLUrM1WLGR/9o=; b=FM2+f76oV3dviUT9OOU4GUX+FjBHP/JxTSfjQ8eir8c4Y6RFPlVMhkNFojuaKQ+Ik+ XizkFledBrCedhK2oZpnWebmD+pqRQjmVjJgD269CWy4X8dKzsxrA+ZIHqK5Lliimqg5 4y9eA5hQ9ygI95nxuzMeHOifAr+3jhSEm3v/EuAAgms+Q7FmtvXceiLKE3c1m5lcNCsC k3/ZVZ4fuWECa1cLVPGo+WHxAuOEaKVV5sKcjcNobuV0r7i+hN4/sEV7tVq1rfEvaPAt ttKjDnxEIs5ZrK3eNjX1aKZAJDSy4FUifoCJIqXTy2a2W8pZmrviKBulSAmO96KAoLMH mWTw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g15si25429989ilc.45.2021.08.11.07.04.26; Wed, 11 Aug 2021 07:04:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232204AbhHKOCc (ORCPT + 99 others); Wed, 11 Aug 2021 10:02:32 -0400 Received: from foss.arm.com ([217.140.110.172]:51498 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230479AbhHKOCb (ORCPT ); Wed, 11 Aug 2021 10:02:31 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AE76C1063; Wed, 11 Aug 2021 07:02:07 -0700 (PDT) Received: from e123427-lin.cambridge.arm.com (unknown [10.57.39.227]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B09CF3F718; Wed, 11 Aug 2021 07:02:04 -0700 (PDT) Date: Wed, 11 Aug 2021 15:01:57 +0100 From: Lorenzo Pieralisi To: Ard Biesheuvel Cc: Christoph Hellwig , Linux Kernel Mailing List , "Rafael J. Wysocki" , ACPI Devel Maling List , Linux ARM , Veronika kabatova , Robin Murphy , Will Deacon , Hanjun Guo , Sudeep Holla , Catalin Marinas Subject: Re: [PATCH v2 1/3] ACPI: osl: Add __force attribute in acpi_os_map_iomem() cast Message-ID: <20210811140157.GA28658@e123427-lin.cambridge.arm.com> References: <20210726100026.12538-1-lorenzo.pieralisi@arm.com> <20210802152359.12623-2-lorenzo.pieralisi@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 11, 2021 at 12:40:28PM +0200, Ard Biesheuvel wrote: > On Tue, 10 Aug 2021 at 18:46, Christoph Hellwig wrote: > > > > On Mon, Aug 02, 2021 at 04:23:57PM +0100, Lorenzo Pieralisi wrote: > > > Add a __force attribute to the void* cast in acpi_os_map_iomem() > > > to prevent sparse warnings. > > > > Err, no. These annotation are there for a reason and need to > > be propagated instead. And independent of that a __force cast > > without a comment explaining it is a complete no-go. > > The whole problem we are solving here is that ACPI, being based on > x86, conflates MMIO mappings with memory mappings, and has been using > the same underlying infrastructure for either. On arm64, this is not > sufficient, given that the semantics of uncached memory vs device are > different (the former permits unaligned accesses and clear cacheline > instructions, but the latter doesn't). A recent optimization applied > to memcpy() on arm64 (which now relies more on unaligned accesses for > performance) has uncovered an issue where firmware tables being mapped > non-cacheable by the ACPI core will end up using device mappings, > which causes memcpy() to choke on their contents. > > So propagating the annotation makes no sense, as we are creating a > memory mapping using the iomem primitive. I wouldn't object to a > comment being added, but I think the context should have been obvious > to anyone who had bothered to look at the entire series. I can add a comment and respin. Basically a __force attribute is added to ignore a sparse warning that's been ignored for aeons anyway - I will add the rationale above. drivers/acpi/osl.c:379:17: warning: cast removes address space '__iomem' of expression