Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4913370pxb; Mon, 15 Feb 2021 04:50:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJxBxHY5zFEags/rmLlN8l3Nw8KpQ9FYM6C7zb2ivWzF9Jr1q6tnEgr6cu/fVvi/JrZ3dQNB X-Received: by 2002:a17:907:35cb:: with SMTP id ap11mr15583499ejc.459.1613393434805; Mon, 15 Feb 2021 04:50:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613393434; cv=none; d=google.com; s=arc-20160816; b=CgCd1tJOhtZxDPgtUS1h4ByHGw6uaU08Uz7QhFrKQULkn0Q3mdFP2jJ3lPpr8UsixN BkW6znI+Y1g8kS1ZPwXjTVtD03rF6nq9k36bibX2TKHMdJKWhYCjppcrbNYtZR13P14c SrNsWgHa1nnUyHb7n6j3PMkEvpWiseea6WC+l2+sV9sYSma4YLcfh5wwHRz9gsGP7Kyw QDBxop57dPBbjl7J4LL76T0b3XraOc9XwK/iRhyJFI2AZ1bHEJNOmuqBBOk1X3lYt8jW GxEJadf4nS5Hsy3YaPPcI0zXjmmAmjYlwQ/FZ2arS06R4powkHWhlihjTfiJNfUXOscJ NfZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:user-agent:dkim-signature; bh=A15rY6Q2dsPIqCz33RJVqDEPuYAVE90BLBpsO2QsoA8=; b=MNUQyL8uj8exDB7WZV0VyMYk4InwyhV+ujBOlHRrYj4K5HtVRUQ+3I8fdlwmzwXRQI si51hUIK1pwPWV6DmG0woeD3QSuKSlpBsK4YKLd3r63InEYD41trKB/D3NSWcHpJbf8U QzXxx6ddlw0+/DMSfrXYXUMr+4MpRICXgdWtwuzKDqo/1lCYADQL0/2dNaGr9/jAzYnv zd67CUBWKcI+SPvGsV5IyfIjJcJvGnIFUWphePv+Wf0TsozCwhT+uCm9MGDQR21XSdYQ ni/9EvKzxrIBXiOsqo5dxCTEpptZlNX/HApP/GfJPQ/s/gpklv6JMpyYc2mNU7p5Hiv1 ATRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dy4ndi0F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id du4si12131986ejc.53.2021.02.15.04.50.10; Mon, 15 Feb 2021 04:50:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dy4ndi0F; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230446AbhBOMry (ORCPT + 99 others); Mon, 15 Feb 2021 07:47:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230239AbhBOMrD (ORCPT ); Mon, 15 Feb 2021 07:47:03 -0500 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8339C0613D6 for ; Mon, 15 Feb 2021 04:46:22 -0800 (PST) Received: by mail-wr1-x42c.google.com with SMTP id t15so8657542wrx.13 for ; Mon, 15 Feb 2021 04:46:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=user-agent:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=A15rY6Q2dsPIqCz33RJVqDEPuYAVE90BLBpsO2QsoA8=; b=dy4ndi0FVQKHpnWLrvojYRRZ7Z0FSDpbqubvH81x2YHRlPHmYbTtqkOTMOnBqutGCj BAZ/13UZ7n/rm6PlLTonfpvxq7XptthgeWpF9V4h8L8mXIEd4ZuTgWsEB38bBe8tiZrm fEcQxrtunUWIP6miHGn6HGrlsUoR+DdhZKa8vVOznlgZXrHrNWfrq+B6ahocIhdTxWnZ Zen4NTCO6qDdWZ7hr3JJDhAWYqYk5N4o7ZQDfteT3Qu5l3rPrujIuOQVWNayyEfb4piz sCohCf8iJNLsafqyRuhaDrtaQgvHUZrLWGmPxW95JAiDeK69uoj0yggn1b6hRo82C5y2 X6aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:user-agent:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=A15rY6Q2dsPIqCz33RJVqDEPuYAVE90BLBpsO2QsoA8=; b=IzH+95L4JZbl26MPsUgVPzr+U1ZWpwQZCEQ14nDqkemlgNEMzw6i8tdNXINk2/q/64 hkrmguzFKvkGzfpIuTr+Mx7maXy66A32Wtr48ajINKDnWVC5nusoc4XiBzsk8eAIiyBZ PE4ZXuHQLkXvHbg0YCXPztJhafMvc6GCelY+xUJv6B/Cjxe1pmegSO6Y/vYzvbo81GrM Uw304AerVGTMmWgQCHGmA9B17l2G2V6frF+Xq1fJHJwQlOtgnSYPsCcaPgFrjij6LVw5 m7/gf4HKHBn87fE+WJ5CU7lr9iuIA4wa7eLX83eML98q1de81iM/lG7ZEk4qEILig6YS BtNg== X-Gm-Message-State: AOAM533hIC1QxP4soRTaD0UXZsAIK41/pQx5kF8fIfQmcHpQQCsvZ3Cy dQigBaDRPijVcBAg7/HWrAXdmQ== X-Received: by 2002:a5d:50c8:: with SMTP id f8mr5187435wrt.69.1613393181489; Mon, 15 Feb 2021 04:46:21 -0800 (PST) Received: from zen.linaroharston ([51.148.130.216]) by smtp.gmail.com with ESMTPSA id j71sm25969899wmj.31.2021.02.15.04.46.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Feb 2021 04:46:20 -0800 (PST) Received: from zen (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id ED01A1FF7E; Mon, 15 Feb 2021 12:46:19 +0000 (GMT) User-agent: mu4e 1.5.8; emacs 28.0.50 From: Alex =?utf-8?Q?Benn=C3=A9e?= To: linux-kernel@vger.kernel.org, "linux-mmc@vger.kernel.org" , "linux-scsi@vger.kernel.org" , "linux-nvme@vger.kernel.org" Cc: Tomas Winkler , Alexander Usyskin , Ulf Hansson , Linus Walleij , Arnd Bergmann , Ilias Apalodimas , Huang Yang , Ruchika Gupta Subject: RPMB user space ABI Date: Thu, 11 Feb 2021 14:07:00 +0000 Message-ID: <87mtwashi4.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Last year while I was implementing a virtio-rpmb backend for QEMU I ended up using patches from the ACRN tree which was based on Thomas' patches last posted in 2016: https://lore.kernel.org/lkml/1478548394-8184-1-git-send-email-tomas.winkl= er@intel.com/ which I bastardised into a testing tree on a more recent kernel: https://git.linaro.org/people/alex.bennee/linux.git/log/?h=3Dtesting/virt= io-rpmb The main reason I hacked them around was because the VirtIO spec had since been finalised and had a very different framing structure. The original proposed ABI provided for an ioctl which sent JDEC frames to the underlying device. This was later expanded to support NVME style frames. Neither of these frame sequences matched the final VirtIO specification. It seems to me having the ioctl ABI at this level exposes too many underlying HW details to user space. With the number of HW devices that providing RPMB features likely to grow from the current 3 (eMMC/JDEC, NVME, VirtIO) it seems this ABI should operate at a higher level, e.g.: PROGRAM_KEY GET_WRITE_COUNTER WRITE_DATA READ_DATA and I guess some sort of asynchronous result check? It would then be for the kernel to take the higher level concepts and translate them to the final frames required to talk to the actual HW (if indeed there is some). Does this seem reasonable? Is this orthogonal to any access to RPMB partitions that file-systems might want to do? --=20 Alex Benn=C3=A9e