From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qv1-f47.google.com (mail-qv1-f47.google.com [209.85.219.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 80E07EEBB for ; Fri, 3 Jan 2025 15:47:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735919281; cv=none; b=He76NEQ4uNzgRzvoBTr/mm7xdTm/bhrNNYSpnJMlBGp1pDRWR8ahiyc9/CX/AHVL/yC3kShVqYJbSD+hPksJ7FZV2IR9Rg1rdsxNL91lZDfTWMj3xqHt6a2Fxv5xnYcVJf6UR+gNKrgjwg8Ol6vgmzGIqe95vJQNfsI3XtL982o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735919281; c=relaxed/simple; bh=x1YRhiBcjzePAFHkv66VCQ/BK2Y0AMCZi/UgyHe1DBM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Z9jlWtG6pOpVYzy1mDvIyDdZ3RmIfC1DMNLn/q9a2DFsQGzi9XDyFIGKgiFfFeCF51tb6gktFbT4LtQbwszbviywXgb06Yf91tNzz3RjVsFvtAEVvJfEkNh1UE5whuFsFEFBZ55glHPb+fs8vdsisaNLpJrbX9B7cae9hS0m+Bk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca; spf=pass smtp.mailfrom=ziepe.ca; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b=GX3jvelh; arc=none smtp.client-ip=209.85.219.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="GX3jvelh" Received: by mail-qv1-f47.google.com with SMTP id 6a1803df08f44-6d8fd060e27so89733106d6.1 for ; Fri, 03 Jan 2025 07:47:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1735919278; x=1736524078; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=x1YRhiBcjzePAFHkv66VCQ/BK2Y0AMCZi/UgyHe1DBM=; b=GX3jvelhRYm/Fj5b6fGm9HxfejtSQQzirPHIFXcn2+Ni/2Yceyf5uKLtbW9zB4QFry 9W0Eb/WeFaFDkSF7hlS+SF68//wFP1ruxXV36Nf/k8+4f+IzqC9DL6wGtFteoKAmYbvi XXDmwOMOnZvCYM8U+FJLudpuNjCqj53u4qNURRk/mrkKcmA1rnI3liqRqXDASSdb+Xwx 8jEZp5lFnt8IYAB8Dc/2Mo1SIaNTtkGJKNURWFU+k48TxegSYmw+cKUcVcsS/JaaYQzw dufs+gjZyjZXDIQrIXc8dgLWoxJ+/PI/OoUK6Lu+lcU4WNqmZFnIts1EtSLSqWW7eC0n Oezw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735919278; x=1736524078; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=x1YRhiBcjzePAFHkv66VCQ/BK2Y0AMCZi/UgyHe1DBM=; b=Sy2oejZPC1zw1UlOIMh7p3c1CJ1r4+V9FIJJgay8ctQn+DNoCBiafuCQgfAfnpfTVG RBRgY+I/b3uxzdK+AAuEIoOZ7A03tIv8Av4iT8LcKM271wzNZzx8drqklAX+XkB4kUH3 f7qb44mjp9frlFJzTn/kd2RuQsr5+eKf4iWcjJfp+o0E5HYNRFEIK6IAQNHmxUF4MMI1 HwKjdqeOdKsOIVPhmHClATpJFxsRxZuFdCIcGgPaeSrLO0s7EGTamuVWrEQb6YG0kSiS J8aqyhk8YzQAXQVNwOIt8M8b2+eMZ2HPJn1hV5kk0bQbFYa6RFHNf9t7FWs0hEOt8l0p qjow== X-Forwarded-Encrypted: i=1; AJvYcCXdIRPhwx7q42U3Evbvv7fhuUa/cz8QdPJ7ewRrZOSmqYIlhIJTrdTTLRnrCsOfv2H7bXerrHF4VVET+bg=@vger.kernel.org X-Gm-Message-State: AOJu0YxEQDpkmxFlVoEtwi60IpL1fPS6aCvD5mMOzTldQuNADDv2n96W fv57h3cdFXNWvCvat6YQSR0sQVA1cbHlz5W3ZoyIqU4B55u/IOYMNYtzCqDcaQVJ4H0IZDaqN6g / X-Gm-Gg: ASbGncsZxCc0gdgcA8wbvz/ZCQ1y5rCAZ7VV2a5Brxenw3g1iJqxKQR7BWggz3qIgJz RrIZbTrj7s2kgjkJeXt1/TiYOpdmI8ZtXgYnOQ0DZ7a3aGDn7JKJGyi5MrKdb2qXlS+RlXXFOft NdAD238YtC1P/Xoj1XWlJ8YCxjf0ZRSnJcatZ/6hQYgRAqUGSofVnXxTiO3tFNy88w0G2NbvzNv ya7qEcmFZy9CfxSqper7pC0pDTOwyugZmbyqwCzkvLQ0Os6XwZ/UxiDB0E3cNPu4ZZBqFhwNXqi w743mTfpAyXwmm1TwhFE5Uozo5arCA== X-Google-Smtp-Source: AGHT+IHsMKKIkxQ7rcmRTm1VnxBXPwiUOd3sAui5NPCMrkirqlLHWMPVy74SUV1oTWvKIM353GCAdg== X-Received: by 2002:a05:6214:1314:b0:6d9:2e0c:56c9 with SMTP id 6a1803df08f44-6dd23308374mr932119066d6.9.1735919278451; Fri, 03 Jan 2025 07:47:58 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-142-68-128-5.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.68.128.5]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6dd31faa052sm120006416d6.9.2025.01.03.07.47.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2025 07:47:57 -0800 (PST) Received: from jgg by wakko with local (Exim 4.97) (envelope-from ) id 1tTju1-00000000jEE-0Nuy; Fri, 03 Jan 2025 11:47:57 -0400 Date: Fri, 3 Jan 2025 11:47:57 -0400 From: Jason Gunthorpe To: Mostafa Saleh Cc: Robin Murphy , iommu@lists.linux.dev, kvmarm@lists.linux.dev, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, will@kernel.org, maz@kernel.org, oliver.upton@linux.dev, joey.gouly@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com, robdclark@gmail.com, joro@8bytes.org, jean-philippe@linaro.org, nicolinc@nvidia.com, vdonnefort@google.com, qperret@google.com, tabba@google.com, danielmentz@google.com, tzukui@google.com Subject: Re: [RFC PATCH v2 55/58] drivers/iommu: Add deferred map_sg operations Message-ID: <20250103154757.GG26854@ziepe.ca> References: <20241212180423.1578358-1-smostafa@google.com> <20241212180423.1578358-56-smostafa@google.com> <20250102201831.GB26854@ziepe.ca> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Fri, Jan 03, 2025 at 03:35:20PM +0000, Mostafa Saleh wrote: > An alternative approach as Robin suggested, is to treat all iommu_map as sg map, > and when the driver gets the iotlb_sync_map() call it can just issue the hypercall, > however this call only provides the IOVA range, which requires extra work or locking > as mentioned in the thread, and as Robin mentioned s390 doing something similar, > I was highlighting that in their driver, this call only notifies the hypervisor > about an IOVA and not an actual pv map as pKVM, so it much simpler in their case. Oh, that is much clearer, maybe incorporate some of that into the commit message. We are going in a general direction of trying to make the fast dma mapping path not require sg, so adding sg specific optimizations to the low level driver is not good. Batching the hypercalls in the gather and then flushing to execute the batch seems more reasonable. You could probably work on advancing this infrastructure separately via virtio-iommu.. Jason