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=-13.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 13C18C433DB for ; Wed, 6 Jan 2021 22:41:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D7D3B23142 for ; Wed, 6 Jan 2021 22:41:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727736AbhAFWlK (ORCPT ); Wed, 6 Jan 2021 17:41:10 -0500 Received: from mga12.intel.com ([192.55.52.136]:26879 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726379AbhAFWlJ (ORCPT ); Wed, 6 Jan 2021 17:41:09 -0500 IronPort-SDR: 2G7uXZx38qvEJ18UftgNhbSXlpEqfzXoi/WVLOqKfrpu8gvgXmnXSEycJ4qumeWft98CDQbC7l TO40fpSMPq2A== X-IronPort-AV: E=McAfee;i="6000,8403,9856"; a="156533380" X-IronPort-AV: E=Sophos;i="5.79,328,1602572400"; d="scan'208";a="156533380" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jan 2021 14:40:44 -0800 IronPort-SDR: gVIpNBQcRtEdSUw22Djyp0LLMuaklw76pkV5bfKK/7Tv5AgWadSSkSXLx7Us9PDXqsuRmLBzQc byl0LaTqUqAA== X-IronPort-AV: E=Sophos;i="5.79,328,1602572400"; d="scan'208";a="462825004" Received: from djiang5-desk3.ch.intel.com ([143.182.136.137]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jan 2021 14:40:43 -0800 Subject: [PATCH v2] x86: fix enqcmds() sparse warning From: Dave Jiang To: bp@alien8.de, x86@kernel.org Cc: kernel test robot , Ben Widawsky , Dan Williams , dan.j.williams@intel.com, ben.widawsky@intel.com, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, linux-kernel@vger.kernel.org Date: Wed, 06 Jan 2021 15:40:43 -0700 Message-ID: <160997283130.3976343.14683889136696879767.stgit@djiang5-desk3.ch.intel.com> User-Agent: StGit/0.23-29-ga622f1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add missing __iomem annotation to address sparse warning. Caller is expected to pass an __iomem annotated pointer to this function. The current usages send a 64bytes command descriptor to an MMIO location (portal) on a device for consumption. Also, from the comment in movdir64b(), which also applies to enqcmds(), @__dst must be supplied as an lvalue because this tells the compiler what the object is (its size) the instruction accesses. I.e., not the pointers but what they point to, thus the deref'ing '*'." "sparse warnings: (new ones prefixed by >>)" drivers/dma/idxd/submit.c: note: in included file (through include/linux/io.h, include/linux/pci.h): arch/x86/include/asm/io.h:422:27: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *dst @@ got void [noderef] __iomem *dst @@ arch/x86/include/asm/io.h:422:27: sparse: expected void *dst arch/x86/include/asm/io.h:422:27: sparse: got void [noderef] __iomem *dst drivers/dma/idxd/submit.c: note: in included file (through arch/x86/include/asm/processor.h, arch/x86/include/asm/timex.h, include/linux/timex.h, ...): >> arch/x86/include/asm/special_insns.h:289:41: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected struct *__dst @@ got void [noderef] __iomem *dst @@ arch/x86/include/asm/special_insns.h:289:41: sparse: expected struct *__dst arch/x86/include/asm/special_insns.h:289:41: sparse: got void [noderef] __iomem *dst Fixes: 7f5933f81bd8 ("x86/asm: Add an enqcmds() wrapper for the ENQCMDS instruction") Reported-by: kernel test robot Reviewed-by: Ben Widawsky Reviewed-by: Dan Williams Signed-off-by: Dave Jiang --- v2: - Update commit log with comments from Dan. arch/x86/include/asm/special_insns.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/include/asm/special_insns.h b/arch/x86/include/asm/special_insns.h index 4e234645f0c6..1d3cbaef4bb7 100644 --- a/arch/x86/include/asm/special_insns.h +++ b/arch/x86/include/asm/special_insns.h @@ -286,7 +286,7 @@ static inline void movdir64b(void __iomem *dst, const void *src) static inline int enqcmds(void __iomem *dst, const void *src) { const struct { char _[64]; } *__src = src; - struct { char _[64]; } *__dst = dst; + struct { char _[64]; } __iomem *__dst = dst; int zf; /*