From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 51A13132462; Tue, 6 Feb 2024 12:17:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707221875; cv=none; b=tJFxTIFiRSosVp8MwZMh7Sd83gKrSrypy0lvAOF75pqikiYT+Kj00BWR96QkQo51i1BwK6naVgKa4BDc1/b7x2dYtFu7y06aOEeiOAixuaHJ2PBgAn91jYlgpSN7Mgwr2RkF7acsgJhNOBnb1/xctIGuonoDRt6Sko6dDgZIhms= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707221875; c=relaxed/simple; bh=6cGoZ9xn2z86dvXzudclTsATn7caJfz0ANjzsrSWXwI=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=MQuVWsHHuu4ja6TK6+PgZqlzl58nhWxUUmj9IUD3xczq3vIJ4ljhrXzxUmeIz4dRhL8SZdqPhi4TriMQMOcAWB56b6KliETrSGr23ceB3xiUSNKslGIy3/X5GtbOge+xZCgCFPvuHvFluf1HUbdKWxqALxHdyHYUkeArBOP8euo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=NYvyxt96; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="NYvyxt96" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 112D3C433F1; Tue, 6 Feb 2024 12:17:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707221875; bh=6cGoZ9xn2z86dvXzudclTsATn7caJfz0ANjzsrSWXwI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=NYvyxt96dLFX15ufMTUANHq/Ku10m9H6gA1NT9B5/sOzstyEwH+p/i26hYTzWs0KD xB9p8+4ku6TAekjZ7ysQYP/gesba0NmOv3vrs0pZQe/bGJcWc9FTzKogpUHzsjqRjR ch2TpSNN48FYBg/obV/jxD1QnN/M7MkZ12BniDAKFUjfY25M2OAKQyPHf3JlBB11sK swTagh7h4TtzFKKdotwYTeYdHAJQT0zCGpSG6Pd4hPPf596GkkuOWAUTJPYSjbr4+Q HwTTqGGWyODghjaFJX6NbCXXDbIhS6QwkqxsnSbSg4MpBv9X7wHbnn2R2osKsC7pul yDq33it+P2Ppg== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1rXKOe-000nz4-Gx; Tue, 06 Feb 2024 12:17:52 +0000 Date: Tue, 06 Feb 2024 12:17:52 +0000 Message-ID: <86wmrh6b2n.wl-maz@kernel.org> From: Marc Zyngier To: Sumit Gupta Cc: , , , , , , , Subject: Re: [Patch] memory: tegra: Skip SID override from Guest VM In-Reply-To: <20240206114852.8472-1-sumitg@nvidia.com> References: <20240206114852.8472-1-sumitg@nvidia.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/29.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: sumitg@nvidia.com, treding@nvidia.com, krzysztof.kozlowski@linaro.org, jonathanh@nvidia.com, mark.rutland@arm.com, linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, amhetre@nvidia.com, bbasu@nvidia.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Hi Sumit, On Tue, 06 Feb 2024 11:48:52 +0000, Sumit Gupta wrote: > > MC SID register access is restricted for Guest VM. > So, skip the SID override programming from the Guest VM. > > Signed-off-by: Sumit Gupta > --- > drivers/memory/tegra/tegra186.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/drivers/memory/tegra/tegra186.c b/drivers/memory/tegra/tegra186.c > index 1b3183951bfe..df441896b69d 100644 > --- a/drivers/memory/tegra/tegra186.c > +++ b/drivers/memory/tegra/tegra186.c > @@ -10,6 +10,7 @@ > #include > #include > #include > +#include > > #include > > @@ -118,6 +119,11 @@ static int tegra186_mc_probe_device(struct tegra_mc *mc, struct device *dev) > unsigned int i, index = 0; > u32 sid; > > + if (!is_kernel_in_hyp_mode()) { > + dev_dbg(mc->dev, "Register access not allowed\n"); > + return 0; > + } > + > if (!tegra_dev_iommu_get_stream_id(dev, &sid)) > return 0; > > @@ -146,6 +152,11 @@ static int tegra186_mc_resume(struct tegra_mc *mc) > #if IS_ENABLED(CONFIG_IOMMU_API) > unsigned int i; > > + if (!is_kernel_in_hyp_mode()) { > + dev_dbg(mc->dev, "Register access not allowed\n"); > + return 0; > + } > + > for (i = 0; i < mc->soc->num_clients; i++) { > const struct tegra_mc_client *client = &mc->soc->clients[i]; > This doesn't look right. Multiple reasons: - This helper really has nothing to do in a driver. This is architectural stuff that is not intended for use outside of arch core code. - My own tegra186 HW doesn't have VHE, since it is ARMv8.0, and this helper will always return 'false'. How could this result in something that still works? Can I get a free CPU upgrade? - If you assign this device to a VM and that the hypervisor doesn't correctly virtualise it, then it is a different device and you should simply advertise it something else. Or even better, fix your hypervisor. Thanks, M. -- Without deviation from the norm, progress is not possible.