From mboxrd@z Thu Jan 1 00:00:00 1970 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=-6.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 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 2EC84C4338F for ; Wed, 11 Aug 2021 14:04:36 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 B9ED160551 for ; Wed, 11 Aug 2021 14:04:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org B9ED160551 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=o2vQWOuFt7+7FJvB9SfIyl/MtNcirwqPC45DGY600nI=; b=ZusvoHNOZc7rY0 yIuOUbLa9W+uqKAA4po3XzKM7r8+F6mYI+EUHLZfG1B3tR+ReD++xIcfKG95oW6esNaSlD687byB8 ItShE39v8Nk+E3uwiCWnbjKWfyQhpzLtJ2owbOjXO7JOZiD+4ke/piyr1cBrD1u0f6d9codl8rvN4 4yTmBopQe2JrDokVXfcrDRMvQaTWXpqfdECbfSDLdfL18g9530Zwgzg+oEUypQI9sL14eDs8aza+h h8VtHw4LYpYIxKnFeY8FBAEwZSW+pXxuHLVvvA/aWbo753wTKVpibLYOESd6E/2orbUYFVVguAwEK h2PN2Hq8wKuzBEiSqvnQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mDooC-007PAK-1K; Wed, 11 Aug 2021 14:02:16 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mDoo8-007P94-0Z for linux-arm-kernel@lists.infradead.org; Wed, 11 Aug 2021 14:02:13 +0000 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-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210811_070212_144896_4DEE6C9D X-CRM114-Status: GOOD ( 23.73 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel