Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1248106pxb; Fri, 21 Jan 2022 13:18:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJzrAz0W41wDk4Tdk3CxJUPjx1YgVASz1VCNwK0eKHdzsgkamKQ9hAx777hoD2Q0MFcQkqUo X-Received: by 2002:a17:902:b189:b0:143:8079:3d3b with SMTP id s9-20020a170902b18900b0014380793d3bmr5349221plr.71.1642799904176; Fri, 21 Jan 2022 13:18:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642799904; cv=none; d=google.com; s=arc-20160816; b=sM6xbdjXO8TG5naxb6l6DdTkJd84DEkFcZDeXXvgdoPjTA0mZa6Kr7rUK9WVmZIrHd LiKL0xYDlbZ+WlZuyvb5WA3B9cE0TPRZSwdlU+xnkcoru6EKdMumnI5RNbbMSvRJnCxP WNJJtNzS3+P79NBrsr4qDtK1rQp0wUvQ6fBjeY2emcwJsq2GLxEil5We9rY/RILcBN0W xj73gOOvJTL7o9UCW0W+02N8b4oOe/uBZp5QtJLLvWB5E5+4f0Ci0ZvuKloYEzr6JYNi WTc4zxdw0DY4+CaqVUDN5/0iDyi4Tb9SWS6dEHQT2sbv2cpVvqby5pbLbs2Wz3q37Zn4 FKjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=sFpN3f0uduDA3tQ7l5sXIVy8xoN2m2qwc3s/2ZpwE2I=; b=Z+kt1SWd0tkJmNEmcjSWS9YPhBQB/98qDJ647izpR7P0m/T/TuuXNg7rOWBa6W9dKy /RCthcPWxbcEz/+dLUQfkIu7/FF3s+CPnE94v2xSFnAfxGkQHY99ZPQMDPuJEPxMZNoI /OJYkpPMYIWhEA2RUUNCKgXO9leUaANP6uNKfijcJzLctJ2rFKnBprWdDGSfunH0JUtv i8M25JbTN8Z/Lx/A6x98sDLxDySXMrbeAnbw1NHnPu0+ND5qyAA2hcw6BCCGTKtiogDP HZLxZoCZj8/iNCQEsrwNDivgousrGK0BlK7Dd6QD7LtB5prVUv4nuRDQQf+luK+ZQXqC ZQlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=CBWQbPJO; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 4si6785316plo.473.2022.01.21.13.18.12; Fri, 21 Jan 2022 13:18:24 -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=@redhat.com header.s=mimecast20190719 header.b=CBWQbPJO; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376332AbiATKif (ORCPT + 99 others); Thu, 20 Jan 2022 05:38:35 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:32989 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242470AbiATKie (ORCPT ); Thu, 20 Jan 2022 05:38:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1642675114; 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=sFpN3f0uduDA3tQ7l5sXIVy8xoN2m2qwc3s/2ZpwE2I=; b=CBWQbPJOD0nY8gsyaGhlSbLLEZ458+TdTU0e1WBVhpuI2tlT4GV4IcSEXYgbT4yrMBylmb JJr4GGUANc6xfq/29dXXryRIM+h7sVZIJ/HWXlkClPOGfE8SPKo4/VqlXdxKu1qMU9p2VR 1FI99IIVAfOp0DpQmmnaRlZ9dy4W4cM= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-73-vmkHaHKdNMqNWmokhEs1pw-1; Thu, 20 Jan 2022 05:38:32 -0500 X-MC-Unique: vmkHaHKdNMqNWmokhEs1pw-1 Received: by mail-wm1-f70.google.com with SMTP id g80-20020a1c9d53000000b0034da9d62199so517919wme.7 for ; Thu, 20 Jan 2022 02:38:32 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=sFpN3f0uduDA3tQ7l5sXIVy8xoN2m2qwc3s/2ZpwE2I=; b=A90JK2g1x3snLO83tsN9cbkRXUaCeCJbbygWF8HVEaGAlcHI8mXwzbd4paaSfaMMDU sGFXAeapGFnnlYvrQ5ButNNKIByO2Ph0yNONuFsg8i0z7AslX38LMr11pbaPVQ0KDXup SuiyULhqzZtSjdLyRjZtAnA2jO2iANS/MGtSvQP+b8r5EBE13C4GtSLaWffO7cmAkQEI FU2LyAGSdeEm/0iTfDNQygPUFTP4YC3VoGRj8Z4wAT8zjrlc/hvldPb8KSkGGL2Oj9K2 eR3XJYheKkUnkW4yVSiE6jEVZRySvsSQZmTHUoJPDd1sP+mYJIHInwmtBGn0Yojel+cT 96vQ== X-Gm-Message-State: AOAM5326Ggp9lzs9r72Xxh2LWMe5cMkE9vDhX92DaSag2UKc+WWdnmUv +r2gJe9ACBO7mnKkTME2tyBqOJSTUdnJ0Hhtc07FRYHoDCkR7zoyhK7JcnTJ3WlDvDiNr4uLp0I M4uP1WHxGy1kBI4nIVp+DtVSI X-Received: by 2002:a05:6000:152:: with SMTP id r18mr3963430wrx.598.1642675111367; Thu, 20 Jan 2022 02:38:31 -0800 (PST) X-Received: by 2002:a05:6000:152:: with SMTP id r18mr3963404wrx.598.1642675111135; Thu, 20 Jan 2022 02:38:31 -0800 (PST) Received: from [10.33.192.183] (nat-pool-str-t.redhat.com. [149.14.88.106]) by smtp.gmail.com with ESMTPSA id n10sm1005966wrf.96.2022.01.20.02.38.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 20 Jan 2022 02:38:30 -0800 (PST) Message-ID: <069c72b6-457f-65c7-652e-e6eca7235fca@redhat.com> Date: Thu, 20 Jan 2022 11:38:29 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Subject: Re: [RFC PATCH v1 06/10] KVM: s390: Add vm IOCTL for key checked guest absolute memory access Content-Language: en-US To: Janis Schoetterl-Glausch , Christian Borntraeger , Janosch Frank , Heiko Carstens , Vasily Gorbik Cc: David Hildenbrand , Claudio Imbrenda , Alexander Gordeev , kvm@vger.kernel.org, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org References: <20220118095210.1651483-1-scgl@linux.ibm.com> <20220118095210.1651483-7-scgl@linux.ibm.com> From: Thomas Huth In-Reply-To: <20220118095210.1651483-7-scgl@linux.ibm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 18/01/2022 10.52, Janis Schoetterl-Glausch wrote: > Channel I/O honors storage keys and is performed on absolute memory. > For I/O emulation user space therefore needs to be able to do key > checked accesses. > The vm IOCTL supports read/write accesses, as well as checking > if an access would succeed. ... > diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h > index e3f450b2f346..dd04170287fd 100644 > --- a/include/uapi/linux/kvm.h > +++ b/include/uapi/linux/kvm.h > @@ -572,6 +572,8 @@ struct kvm_s390_mem_op { > #define KVM_S390_MEMOP_LOGICAL_WRITE 1 > #define KVM_S390_MEMOP_SIDA_READ 2 > #define KVM_S390_MEMOP_SIDA_WRITE 3 > +#define KVM_S390_MEMOP_ABSOLUTE_READ 4 > +#define KVM_S390_MEMOP_ABSOLUTE_WRITE 5 Not quite sure about this - maybe it is, but at least I'd like to see this discussed: Do we really want to re-use the same ioctl layout for both, the VM and the VCPU file handles? Where the userspace developer has to know that the *_ABSOLUTE_* ops only work with VM handles, and the others only work with the VCPU handles? A CPU can also address absolute memory, so why not adding the *_ABSOLUTE_* ops there, too? And if we'd do that, wouldn't it be sufficient to have the VCPU ioctls only - or do you want to call these ioctls from spots in QEMU where you do not have a VCPU handle available? (I/O instructions are triggered from a CPU, so I'd assume that you should have a VCPU handle around?) Thomas