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 72C2DFF8861 for ; Mon, 27 Apr 2026 08:55:09 +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: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=V6v3vNLYVnb4b6WYhYDeVIdl2ZjKM88HaiMCmHvWTqE=; b=lHGr4Q5b3ZN98TQECJb7OSIJme HbbD+BZUBjYZZ0TzAf1AeYw5MVbNuCyho+tQMwxvbcw0hlRUaIIb46viSmDkNJGqpk3JhF0AI7ddE h3NVvEFKhvAZ3ks1zEcKDZkERpn2tCFaS7N7PHEpCwdls005IZ3wYS6mxQXvjGK7v+xsJLGa38B5Y u6y7fEI2fAauCU0yHtGQOWMpXYLyyMYCGvHCHdZvnCWHtvMPtC/Bq0r7BXMYfJFl7f/7HAH6sEH4H LmjESPXxME2vF/y8jdCrnRwhOx2VZR84xad2ThWOHLFHMdl+xp0TFipdDxnuk8euuiZzVnuGgnh/A LLAPbRhg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1wHHk7-0000000GVOG-43BJ; Mon, 27 Apr 2026 08:55:03 +0000 Received: from sea.source.kernel.org ([2600:3c0a:e001:78e:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1wHHk4-0000000GVJx-0BZc for linux-arm-kernel@lists.infradead.org; Mon, 27 Apr 2026 08:55:02 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sea.source.kernel.org (Postfix) with ESMTP id A3A4E443D9; Mon, 27 Apr 2026 08:54:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7D0BC2BCB4; Mon, 27 Apr 2026 08:54:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1777280099; bh=FMIwcNzgQyYKvL/+VdDInu0xZqfxtBHYoAbYHmw9Y1E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pwAEva7Eiw8ewW8ECOCxJreq6BTnnayRalaegblh3LPzBMyCpU9hX/F8BuQ07JFJ7 CEwNANrORLr1mnf308c/D1nWoEdyjp25pPwhH8j8HINKwWWvZuaBwF/BjAgAHp/4mZ 96F2wDws84i4E2I9xaMrpPSpr+n6WYxAHtG9yufJ0k9s9o/nt7sHxgE8bKqAERUDD0 fryzmuOm3GRQrpDlEHHojWOo3Wj6v+xyLk2P/hkOCCN3NbUjIaknN7Eyd2mZkDMtXp BRLqba+30jEu3ZpnOYdy2/svbk/siPHCgS+sVwlmG9S7cWGriWirEf49lluDpqgk7G roPawwNSsmf7A== From: "Aneesh Kumar K.V (Arm)" To: linux-coco@lists.linux.dev, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: "Aneesh Kumar K.V (Arm)" , Alexey Kardashevskiy , Catalin Marinas , Dan Williams , Jason Gunthorpe , Joerg Roedel , Jonathan Cameron , Marc Zyngier , Nicolin Chen , Pranjal Shrivastava , Robin Murphy , Samuel Ortiz , Steven Price , Suzuki K Poulose , Will Deacon , Xu Yilun Subject: [RFC PATCH v4 10/16] coco: host: arm64: Add helper for cached object fetches Date: Mon, 27 Apr 2026 14:23:38 +0530 Message-ID: <20260427085344.941627-11-aneesh.kumar@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260427085344.941627-1-aneesh.kumar@kernel.org> References: <20260427085344.941627-1-aneesh.kumar@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260427_015500_136738_161B1FB2 X-CRM114-Status: GOOD ( 13.32 ) 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 Introduce vdev_fetch_object_work() so we have a single workqueue handler that refreshes any cached Realm object (interface report, measurements, certificates). The helper receives the cache buffer/offset/size via dev_comm_work, clears the existing contents under dsm_dev.object_lock, performs the VDEV_COMMUNICATE call, and uses the updated size to signal failures back to the caller once the work completes. Signed-off-by: Aneesh Kumar K.V (Arm) --- drivers/virt/coco/arm-cca-host/rmi-da.c | 26 +++++++++++++++++++++++++ drivers/virt/coco/arm-cca-host/rmi-da.h | 3 +++ 2 files changed, 29 insertions(+) diff --git a/drivers/virt/coco/arm-cca-host/rmi-da.c b/drivers/virt/coco/arm-cca-host/rmi-da.c index 3db42c21dab0..63b20c8aef54 100644 --- a/drivers/virt/coco/arm-cca-host/rmi-da.c +++ b/drivers/virt/coco/arm-cca-host/rmi-da.c @@ -1138,6 +1138,32 @@ void cca_vdev_unlock_and_destroy(struct realm *realm, host_tdi->realm = NULL; } +static void __maybe_unused vdev_fetch_object_workfn(struct work_struct *work) +{ + int state; + struct pci_tsm *tsm; + struct cca_host_pdev_dsc *pdev_dsc; + struct dev_comm_work *setup_work; + + setup_work = container_of(work, struct dev_comm_work, work); + tsm = setup_work->tsm; + pdev_dsc = to_cca_pdev_dsc(tsm->dsm_dev); + + guard(mutex)(&pdev_dsc->object_lock); + + if (setup_work->cache_size) { + memset(setup_work->cache_buf, 0, setup_work->cache_size); + *setup_work->cache_offset = 0; + } + state = do_dev_communicate(VDEV_COMMUNICATE, tsm, RMI_VDEV_ERROR, NULL); + /* return status through dev_comm_work.cache_cache */ + if (state == RMI_VDEV_ERROR) + setup_work->cache_size = 0; + else + /* indicate success. This value is not used. */ + setup_work->cache_size = CACHE_CHUNK_SIZE; +} + int cca_vdev_get_object_size(struct pci_dev *pdev, int type) { long len; diff --git a/drivers/virt/coco/arm-cca-host/rmi-da.h b/drivers/virt/coco/arm-cca-host/rmi-da.h index 4f1a61a5dcfa..c1fc7c01943e 100644 --- a/drivers/virt/coco/arm-cca-host/rmi-da.h +++ b/drivers/virt/coco/arm-cca-host/rmi-da.h @@ -28,6 +28,9 @@ struct cache_object { struct dev_comm_work { struct pci_tsm *tsm; int target_state; + u8 *cache_buf; + int *cache_offset; + int cache_size; struct work_struct work; }; -- 2.43.0