From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com [209.85.208.50]) (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 42BE13EFFD1 for ; Mon, 24 Aug 2026 09:05:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787562321; cv=none; b=Ma7h/Jv5u0egSDC7ghErZyj6meDnIKU2dxtH6kBIrLFk/LK3tlhPBzU/+JHS8gqvf2dY7Gz0GUsazgRR7ss6pXK/wZvlH8D/PuF/Ux3hVIujGSYtj24xwZb/6+sStvFLLkQ1vB6uyt4uuyLc8I2lqUmlW1QIzf5fTG394/XEOD0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787562321; c=relaxed/simple; bh=yxdOwrSsTMciXo/tP789U3pWWmqLPlJh5w2RmaTvaj0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=OsPQUvjfmxMtQyPgoYIdCPineeylofNwZQOKbKXMoW7KHgNctVC9dKEW/mCbOBzStWFRGWcIRZcHzIcaOZvJi2t+frCYHqvuPc2+3cgHkazGf8HAbpo99lDl5+An9L4z6yEAtzO5XWe1K3HTp9FsU/ZfeJWmdvC+iS4YwcJc3MU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=ADpjpmTe; arc=none smtp.client-ip=209.85.208.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="ADpjpmTe" Received: by mail-ed1-f50.google.com with SMTP id 4fb4d7f45d1cf-698b78c05b0so11731a12.1 for ; Mon, 24 Aug 2026 02:05:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1787562317; x=1788167117; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=0oE7bRBEKrds8LRc7kKAKPBdAOrOs9h0iRGg0/2yeYk=; b=ADpjpmTe4eg6hH+jotoO0D+Dk4gYvZRy1Lmxos+yZCaSUkF3INVJM7LMErG1l5pzSu GS7kPI2MnUgSTTFtk5x1Xlr/ZrATU+gO30y/vUiylabKCvK4Wk+1ZbJoSZmU8NcVhXDg r4UqkMfmwLxIGjpieJa35uxU9cexC/RXovRwg5Uogcz2qfNMLIn8VRC+bKZikm+E0q1+ TBXnGiiJgIg64s6aGV6Q2LgH6eUwTyMqQ63oJ/+Vx9X5hrU7NVCKthbIYfMt8QDZfE/n t/vjq+viGRCUEX8a82KT/0HU7Oa4IkVlRQPl8IHllAMFgV4QJVJWdrV7zU0V9l63V3bu rpaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787562317; x=1788167117; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=0oE7bRBEKrds8LRc7kKAKPBdAOrOs9h0iRGg0/2yeYk=; b=cm+dA4UolJNa7YUQZ199cwqTh7aGh/OlECa0ciuA7bkOpuCgGzaZ7EwbfTNIf5Oc4U oSlZO8wJ4k3g8H9qkgpbUW9limjqFaQGC6rpoWVYjM02RJn7dAH8+8713m4A+qdNcQMQ ZplWxpmjCrZfSvmTlExMv7iTUViSZ0EmSPdqiB9Camebu/d8RXneFHTpAxZqG0jnFtiP yDii+HO0eCGdRKjj3uRBYTp9B5GxgnAIPnp6Qjo0+LhrEvIwpXUnq+ge14kxQ0XhklMR +FQ0Kr/kt9VZXxT2BqA6zKhi/sh2K38njrh9weaEYql19RdT7yLGaK+JEfAvdKFCl96Z YvcA== X-Forwarded-Encrypted: i=1; AHgh+RoqQD84N0PYA3s6/qsUi3afkhozor+kDU1anGLuU+RdtahIMLyRjg2iz1p8moL1c+yrm150UyW969X6lII=@vger.kernel.org X-Gm-Message-State: AFuF++kTl0snuKi7TW/KjvkinOdy0BT/GpkeNrXilXalw+Sv1FW9/OU+ u7MtIYlJUjKgtrzJz4On6Tjbz7bJskbn7xd0CTHdlj9CZtDA3NCt0Yt3AEk5HSpO3w== X-Gm-Gg: AR+sD10HGHW7bI7PEjHD7Yfq4cBZNlj4kZTt18vF1zqyfawPN74vZnrn/4tnDB0dSuV cpsU4+h568xC4yG6oOb4n5Wcc6wngvWvFxNPSScwL/PUp/J89a+/FxW/IYguQ2/Ofjq742hYs2a CjbYlX2sRbpumFbqpBcOi0zravSyXCjFzBTTZzsxalTW3IOfHGLp2aumAdLb2St33IwcKDVDSh0 NZ8/DXBq1ysHJX6fwEaf2i6Pk9o4qRQB+3i3GEo4iCA6wV4mkAc1P6D7uVM6m+YC1w5JrpY5tCm 0mQpIsSVJ2z0GOWTWJ9z3nnf8+9AyTp8/XZg0yvQ+/kv3nLsKipmRPVyjwnlMp1WrcT/YPHsUdO +L+LCqiJyFgz5RaY+kWftDP4+sC8phmIH8zpdD8DVpTGC+69A2uaCxnUy99X4BR3e4hHbTqilml dn9YsZ4kFjU535L1hfIMBRYl9luEKHqmUel0Yvqw83RaVAiz6O93DBpqlPu4a+qGa7iBRxRlCLF g718YFXAwVw8ho/MKL0CGmnnIAXG1ak X-Received: by 2002:a05:6402:a50d:20b0:672:117e:55d4 with SMTP id 4fb4d7f45d1cf-6a582669e18mr65014a12.0.1787562316885; Mon, 24 Aug 2026 02:05:16 -0700 (PDT) Received: from google.com (63.235.189.35.bc.googleusercontent.com. [35.189.235.63]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c2496738e8bsm1063366966b.44.2026.08.24.02.05.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Aug 2026 02:05:16 -0700 (PDT) Date: Mon, 24 Aug 2026 09:05:12 +0000 From: Sebastian Ene To: Mankyum Kim Cc: Marc Zyngier , Oliver Upton , Will Deacon , Fuad Tabba , Andrew Walbran , "linux-arm-kernel@lists.infradead.org" , "kvmarm@lists.linux.dev" , "linux-kernel@vger.kernel.org" Subject: Re: Re: [PATCH] KVM: arm64: Allow smaller FF-A RX/TX buffers Message-ID: References: <20260820-master-v1-1-ea602b6d3860@samsung.com> <20260824005345epcms2p8db2a7aad5598b624129873d1a1abf8ff@epcms2p8> 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: <20260824005345epcms2p8db2a7aad5598b624129873d1a1abf8ff@epcms2p8> >On Mon, Aug 24, 2026 at 09:53:45AM +0900, Mankyum Kim wrote: Hello, >Hi Sebastian, > > > >Thanks for the feedback. I took another look at the SPMC capability >reporting and found an important detail that I missed in v1. > > > >With FF-A, the SPMC in this configuration advertises both the minimum >and maximum RX/TX buffer sizes as 4K. `hyp_ffa_post_init()` currently >only considers the minimum size and ignores the maximum. > (making it readable as the reply was sent in html format) The max size discovery has been added from FF-A 1.2. Old SPMCs with < 1.2 will not have it. > > >I agree that the host-facing FFA_FEATURES should report pKVM's RX/TX >requirement, as you suggested. That would keep the host/pKVM mapping at >the host page granularity and also avoid the partial-page sharing issue >Marc pointed out. > > > >However, with a 16K host/pKVM, the host would then request: > > > >``` > >FFA_RXTX_MAP(..., page-count=4) > >``` > > > >and the current `ffa_map_hyp_buffers(npages)` would forward the same >page count to the SPMC. This SPMC advertises a maximum RX/TX buffer size >of 4K, so the 16K mapping is rejected. > Right, I see what you mean. In this case we would have to : - keep track in a variable for the size of the hyp mailbox buffer (pkvm_ffa_bufsz) let's say - make hyp_ffa_post_init aware of the max RX/TX discovered size if we are running with FF-A >= 1.2 if max_rxtx_sz < PAGE_SIZE * KVM_FFA_MBOX_NR_PAGES: pkvm_ffa_bufsz = max_rxtx_sz; - if we are running with FF-A < 1.2: pkvm_ffa_bufsz = min_rxtx_sz - update the code for the host-facing FFA_FEATURES to report pkvm_ffa_bufsz when queried from host and make sure we use that instead of the paths that use KVM_FFA_MBOX_NR_PAGES > > >It therefore looks like supporting this configuration would require >separating the host-facing RX/TX size from the SPMC-facing RX/TX size. I >also noticed that several paths currently use `KVM_FFA_MBOX_NR_PAGES * >PAGE_SIZE` as the capacity of the hyp buffers, so simply mapping the hyp >buffers with a page count of one doesn't seem sufficient. > > > >I'll drop the approach taken in v1. > > > >Does this match your understanding? In particular, do you think your >configurable mailbox work could be extended to support different >host-facing and SPMC-facing RX/TX sizes, or would you handle that >separately? > > > >Thanks, > >Mankyum Thanks, Sebastian