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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id CD6D2CED258 for ; Tue, 8 Oct 2024 02:53:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=M4sFhYYgaf5zWGjjw37V+FmIhrEBzr4NtQ/62b1VBOU=; b=pdfG0SlCc3FbZSI+nRxmqVEFaz u12M7HPU9EkTD3uffxU1xCYJs9C12h/xV/tYUcjzZH0NDsG+7CjDfwJpd2lSbyPfp2tLmrDKYNygs oqonJCsWB/r9TAdMVEivulV+rdABxzrJPh38yoWCM5+j33rfKcDEviK9nVwZ8u/LRYSfkh5GIvpsg TU7e9E560C1/jUcChdhTkVXhG/fYZhE8Y5ouA/ouiVGJ0HWqR/JP7hFFPg3TRiYLq06z7LhA8J3Gd YaQC0/b6WXconSk11RYPP5DYVxxo0ptL2lbvw+C5zhRdNLZFaK0gx/llc4xhvQMM4Mqk3CWoEZ1Y5 nHCH/J5A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sy0LH-00000004Kgm-3Uvn; Tue, 08 Oct 2024 02:52:55 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sy0Jy-00000004KTP-3i38 for linux-arm-kernel@lists.infradead.org; Tue, 08 Oct 2024 02:51:36 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728355893; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=M4sFhYYgaf5zWGjjw37V+FmIhrEBzr4NtQ/62b1VBOU=; b=GITWFG0zE1uLeyNepEorlyib5mxHxBlqqChILnPFtlyXOx/1rjBdO//NOLp+GG7LQztAEX sJKQWZQRA+8HsabnQBggqBOS5X24oBskd4CwQoqe5bl6gIzRruM3q43e+7vPNlz7PGGneB YyCme9PYuenb++IrccLeMFNG0bk483g= Received: from mail-pj1-f72.google.com (mail-pj1-f72.google.com [209.85.216.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-613-FQH_EIfHOfq5CkMLS3FYrQ-1; Mon, 07 Oct 2024 22:51:29 -0400 X-MC-Unique: FQH_EIfHOfq5CkMLS3FYrQ-1 Received: by mail-pj1-f72.google.com with SMTP id 98e67ed59e1d1-2e2812b5ff8so421190a91.1 for ; Mon, 07 Oct 2024 19:51:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728355889; x=1728960689; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=M4sFhYYgaf5zWGjjw37V+FmIhrEBzr4NtQ/62b1VBOU=; b=P2mAfFPuhsMoCAWgdenirtTucop+Dzp/RcffznlFTwZpoB7F+FUozI/omRESnkqiRR s4BlFIP9fvBNan7BIxyB/4HIrP44DK9OoEQHu51bwxeLfeaJvvvcMVy86rlVXioSGMIe vNNAal1hTROq0WNcBrfZWyme73Mw4/xAFj81Yxi3bBKfby72w7+twa7ostvO2J29h3Oa jJYBNXrvdgoee71oujHPUyCeFy+EPQHOq4yy/TBURD8Qk7fJFqp1qcofNS1YPKIecSv3 IYgubDJAwAzZL3UIt1kgL8/RezcJI8RgnAxziOEY8psJMSDThjzKnBzF40jx+uiOwxDX aGiw== X-Forwarded-Encrypted: i=1; AJvYcCUJtp75LxxxHZ02ki0GlJ9HC55cWlrqzdXmHemPAqWVqX6PHlmAINUTqj3KHd2eNC6tcSpBXNk7WTk4PSu34tRL@lists.infradead.org X-Gm-Message-State: AOJu0Yw1MVpHrion7Yy9uQFgAKdgP9SY5xQt+BKqK8/Zw1WYDPM1sXPT kTZCWwAjRJK+Z6q2I+chy6OaiHfjbb+IbB/L8UqONM7C1hpVJBQyurXT+HbwjUcWo1YGAlydU+c 8USjeEHnlckIJNnAvUiNJoVIAF5Ngrp5r/Kg/UUTCja/h9KFKaEphQCzTmBRz9B4cQmoRY2wc X-Received: by 2002:a17:90a:3d81:b0:2d8:8d60:a198 with SMTP id 98e67ed59e1d1-2e1e6366bd6mr19154103a91.37.1728355888977; Mon, 07 Oct 2024 19:51:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG1a155oDsYUskhbrb04GQtySwR7IiTCMTLOrXqEs3PGt+CLIahMwaNAu0NiGjx/qhM6odUKA== X-Received: by 2002:a17:90a:3d81:b0:2d8:8d60:a198 with SMTP id 98e67ed59e1d1-2e1e6366bd6mr19154081a91.37.1728355888658; Mon, 07 Oct 2024 19:51:28 -0700 (PDT) Received: from [192.168.68.54] ([103.210.27.132]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e20b0f9c7csm6264516a91.38.2024.10.07.19.51.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 07 Oct 2024 19:51:28 -0700 (PDT) Message-ID: <01f08a52-3b96-4384-b9cf-aa74ea1d5faf@redhat.com> Date: Tue, 8 Oct 2024 12:51:20 +1000 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v6 07/11] arm64: Enforce bounce buffers for realm DMA To: Steven Price , kvm@vger.kernel.org, kvmarm@lists.linux.dev Cc: Catalin Marinas , Marc Zyngier , Will Deacon , James Morse , Oliver Upton , Suzuki K Poulose , Zenghui Yu , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Joey Gouly , Alexandru Elisei , Christoffer Dall , Fuad Tabba , linux-coco@lists.linux.dev, Ganapatrao Kulkarni , Shanker Donthineni , Alper Gun , "Aneesh Kumar K . V" References: <20241004144307.66199-1-steven.price@arm.com> <20241004144307.66199-8-steven.price@arm.com> From: Gavin Shan In-Reply-To: <20241004144307.66199-8-steven.price@arm.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241007_195135_034886_07FC83DB X-CRM114-Status: GOOD ( 15.50 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 10/5/24 12:43 AM, Steven Price wrote: > Within a realm guest it's not possible for a device emulated by the VMM > to access arbitrary guest memory. So force the use of bounce buffers to > ensure that the memory the emulated devices are accessing is in memory > which is explicitly shared with the host. > > This adds a call to swiotlb_update_mem_attributes() which calls > set_memory_decrypted() to ensure the bounce buffer memory is shared with > the host. For non-realm guests or hosts this is a no-op. > > Reviewed-by: Catalin Marinas > Co-developed-by: Suzuki K Poulose > Signed-off-by: Suzuki K Poulose > Signed-off-by: Steven Price > --- > v3: Simplify mem_init() by using a 'flags' variable. > --- > arch/arm64/kernel/rsi.c | 1 + > arch/arm64/mm/init.c | 10 +++++++++- > 2 files changed, 10 insertions(+), 1 deletion(-) > Reviewed-by: Gavin Shan