Received: by 2002:a05:7412:85a1:b0:e2:908c:2ebd with SMTP id n33csp110832rdh; Mon, 30 Oct 2023 15:50:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHJLlfdzNHFlQcej3xYL3FQs24yN+FPsEStaNZQWQN5z2IbSPJA9ZVGtjTlScsN7wHCO6Ah X-Received: by 2002:a05:6870:4202:b0:1ea:7bd1:c48d with SMTP id u2-20020a056870420200b001ea7bd1c48dmr15888487oac.49.1698706238611; Mon, 30 Oct 2023 15:50:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698706238; cv=none; d=google.com; s=arc-20160816; b=0TOkfftplot94ceDig19GW2g8qWlSB9rEi5x4SgxNTjBO6JTHWrinGih44tLhQVLrM Jze3hY268C0/Ljw/JnwKZTZ8rm1eTMCDvayBXIRXXUjQP1nLLV4vkeS6R0sx/JTsclfu xRXY/WxAd0sRwEDCBbu2Xmuop1FIE5uUv2JEeAN/WsVNdL3uAeRJxVPA5+PeSZHFpPCp CUC58zSX3Aluo9jASyhrw6ZrKzlEhezd8SrtynTJAmLY0oiFdHdFSqEMQ5TZmOnZwpMW I4FogcEcWEGPrRn8R6MXQF4GAoUCHM3k+9dx2F4ti/5RnMqHkCO/RAlhQzMkvk9KFGAm JIEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Ol71Wy23MLqAWlJq8ZIGhp6OorJwOj5RE9vie1iTxBI=; fh=iZkrctV3hSya4U/kbpEB4CjP8eLJ08gBvMTmpkMdZNY=; b=aP05NomMPuqQHLzktZQVZIpZYePCER+qoMlv77Da2QDXaWdgp2Kl/eTNY/1/wYM0Uw ecQswNRYZ+cNvnpj39yEmkC3K3zUJgnviAmdXS5M2nL9XVfL7th/G7KSVjcmXZEhBsTu 53MJLYqz7my/XAEECkvHiuQ5Ba8vUn5TQAro392siHt1YcWjBGH9FPsBVm15ryo/Fvjw qyYvjGADuTcjHFGvO/iipH7Sd5ZpVlOpNODLxzcVk6aTnKvs+Lhu623vmovxvmRxTk7i 1IvJ6Pd1Fa5o1+9o3PxmUSY0Ew+lPG/iFBsCH226o6ecVvurfupIakmpb+6AqIvyj9Nk syhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=JuetohCp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id n19-20020a637213000000b00578a7f5a0b1si91043pgc.393.2023.10.30.15.50.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 15:50:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=JuetohCp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 10EB5807F2B0; Mon, 30 Oct 2023 15:50:36 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230383AbjJ3Wu2 (ORCPT + 99 others); Mon, 30 Oct 2023 18:50:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229646AbjJ3Wu2 (ORCPT ); Mon, 30 Oct 2023 18:50:28 -0400 Received: from mail-pl1-x62c.google.com (mail-pl1-x62c.google.com [IPv6:2607:f8b0:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E99548E; Mon, 30 Oct 2023 15:50:25 -0700 (PDT) Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-1cc55bcd51eso2345545ad.0; Mon, 30 Oct 2023 15:50:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698706225; x=1699311025; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Ol71Wy23MLqAWlJq8ZIGhp6OorJwOj5RE9vie1iTxBI=; b=JuetohCpSC/VS6nclBxAf7zvP+xioCQH4kw/XmEZEfe/orDYLVI1ELSmwUDS6M+yxk hiXd9RraKr7+U3BCF8+aT4tpka+88nINtUOq5q2q2zFXu0/vTCDO7cOByHY8y1YrQuWz P7g92BhDd8OEZsH1pUnLdmAK/Bv77S/WWOWKek2xW2glh+SUKZ9foMrsxegKlVLH065s 2Ma96EBhjbhaRVp5GnxLlKYZzp3cL/vdULQZa5mEkvbPBsrsvKlbGUrxdSfzqUQLYKiV lB1x7FBRUcZZOyjH1LIXJcFnUUGVZUIjAtX6znBBZ4NgNB7oqp+rdFmfLpx0KnXp6s34 p+3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698706225; x=1699311025; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Ol71Wy23MLqAWlJq8ZIGhp6OorJwOj5RE9vie1iTxBI=; b=RVGHvTO8k51KZES3pg0M9fNgh5bczkOeWuJa7ncz9J7LunL2fVtpA6Q7+YuhTLHyfR PAbQqa2razDdQ9mANaFbC9Osf4XqQFEomQkQrAklXo6JEdtscaF6T8d3GiNGN0Nu+u+8 C6Io+8Bi2rDFkf5CyufsF3T4o2TVezzrDKl5kDZymjw1JzS6DZcalaeAqjh8VCYDi7Q6 OejcaieCqvR3aBuf1uSzk2joh3GadCZp0kv180rbMh9sfLCQ+CCNsY6ijm2y8ZiVA+B3 +ycGe3jc5cD3drDe+g19K0bx6s2JQmOLTJHhtwNECll6QGlH/0oSxecG8Nm0Jah7+ieb GRqQ== X-Gm-Message-State: AOJu0YxayFr+SY7ZBrBcW4IYlWRxXERLYdcPcWzkN28oXaE+9X1lSQHs rxdOSXoIsrj14ev988RPmdfnwmUGVA5Cb+tM X-Received: by 2002:a17:902:e906:b0:1c0:bf60:ba82 with SMTP id k6-20020a170902e90600b001c0bf60ba82mr12045288pld.5.1698706224955; Mon, 30 Oct 2023 15:50:24 -0700 (PDT) Received: from abhinav.. ([103.75.161.210]) by smtp.gmail.com with ESMTPSA id y6-20020a170902ed4600b001c898328289sm34350plb.158.2023.10.30.15.50.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 15:50:24 -0700 (PDT) From: Abhinav Singh To: linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org Cc: hpa@zytor.com, x86@kernel.org, dave.hansen@linux.intel.com, bp@alien8.de, mingo@redhat.com, tglx@linutronix.de, decui@microsoft.com, wei.liu@kernel.org, haiyangz@microsoft.com, kys@microsoft.com, niyelchu@linux.microsoft.com, Abhinav Singh Subject: [PATCH v2] x86/hyperv : Fixing removal of __iomem address space warning Date: Tue, 31 Oct 2023 04:20:03 +0530 Message-Id: <20231030225003.374717-1-singhabhinav9051571833@gmail.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 30 Oct 2023 15:50:36 -0700 (PDT) This patch fixes two sparse warnings 1. sparse complaining about the removal of __iomem address space when casting the return value of this ioremap_cache(...) from `void __ioremap*` to `void*`. Fixed this by replacing the ioremap_cache(...) by memremap(...) and using MEMREMAP_DEC and MEMREMAP_WB flag for making sure the memory is always decrypted and it will support full write back cache. 2. sparse complaining `expected void volatile [noderef] __iomem *addr` when calling iounmap with a non __iomem pointer. Fixed this by replacing iounmap(...) with memumap(...). Signed-off-by: Abhinav Singh --- v1: https://lore.kernel.org/all/19cec6f0-e176-4bcc-95a0-9d6eb0261ed1@gmail.com/T/ v1 to v2: 1. Fixed the comment which was earlier describing ioremap_cache(...). 2. Replaced iounmap(...) with memremap(...) inside function hv_cpu_die(...). arch/x86/hyperv/hv_init.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c index 21556ad87f4b..2a14928b8a36 100644 --- a/arch/x86/hyperv/hv_init.c +++ b/arch/x86/hyperv/hv_init.c @@ -68,9 +68,11 @@ static int hyperv_init_ghcb(void) */ rdmsrl(MSR_AMD64_SEV_ES_GHCB, ghcb_gpa); - /* Mask out vTOM bit. ioremap_cache() maps decrypted */ + /* Mask out vTOM bit. + MEMREMAP_WB full write back cache + MEMREMAP_DEC maps decrypted memory */ ghcb_gpa &= ~ms_hyperv.shared_gpa_boundary; - ghcb_va = (void *)ioremap_cache(ghcb_gpa, HV_HYP_PAGE_SIZE); + ghcb_va = memremap(ghcb_gpa, HV_HYP_PAGE_SIZE, MEMREMAP_WB | MEMREMAP_DEC); if (!ghcb_va) return -ENOMEM; @@ -238,7 +240,7 @@ static int hv_cpu_die(unsigned int cpu) if (hv_ghcb_pg) { ghcb_va = (void **)this_cpu_ptr(hv_ghcb_pg); if (*ghcb_va) - iounmap(*ghcb_va); + memunmap(*ghcb_va); *ghcb_va = NULL; } -- 2.39.2