From patchwork Thu Jun 13 10:44:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 803865 Delivered-To: patch@linaro.org Received: by 2002:a5d:58c5:0:b0:35b:5a80:51b4 with SMTP id o5csp239812wrf; Thu, 13 Jun 2024 03:44:50 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVleDhfCZjdxrlaC0/GCmN5Uph7206BbtNsf0s6ywDc4iiUJ4XgjzdUYu5I/YdMo/ykRpMm3nHlC1fJOo3MIKbu X-Google-Smtp-Source: AGHT+IE4y6izR6t5inflb8/ZaoTa/2iQPKJqD+p1op97OgAwInYSjp9UM416JleXV9DFPlQAV/n3 X-Received: by 2002:a81:a147:0:b0:61a:f206:bad6 with SMTP id 00721157ae682-62fbb412810mr42949017b3.30.1718275490384; Thu, 13 Jun 2024 03:44:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1718275490; cv=none; d=google.com; s=arc-20160816; b=CIloAHqDpldEw3QwcX7VSB4VqhiG8hLTvpFaB/NXN/wPkcNVF0XGJaLCUE+EwsZeVq n/f+kCtWfytB3V3pPPhfGJRyJjcyNV460C/VSepYd+cULpLqj2iUlFbsHeg8e3vQjhyt FsvOuROkYw5ViQ75JNwqRO7tbrOe06J7qIQhViebf3e2AA4DQOWwME1PUTuaDU8sVv0a sBMJZDnQf7LY4C0HVIVxQn0GpR8kf9Ry022tChjxWYnD2AByhiTQDUv8pIb9bqavDYUi GljJ8iwRRjlb8jhHBaA6ZWYzyDb1/fGkAiPIXGFH+ZQIW2d+7OinCtfCijIEVSnUj7OF ksmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=9bb2eJ+cyDtCSIGPEF3KqVqxXfOihaXK/Jl7Nmci3es=; fh=xBDq+vw2O4NzhKQlMCAv2ESMCrOs2fHGJ5yzjmHHQ6k=; b=UpEW4DtiWdOot8EtEy1clT29f40sC8IW5THa5/0rbR2b0aBl/vsK0d0eZkY/09mLbQ dEJBNyNYU3fQh0sqINTi66zptM4k967WpRugC2f/kPKg7oAjjRm5FFqacGwqr7L9RPGL DPdm/vw0/k44JCh9tpK4uVi96BGPUoKUgZHqrVdPRF1ST6gNNw3zejj9hgmqjcZQmALA x8Ye+adya5Dz861zdavjPvxTdOwx0ZgZlMLmjOjv/orlU3dRmtp2BAVMYc2QVB/zxEKt BWeOtPRHRDJa2MkvnNn4LBrgLZH65SvJkyLD9hEk1XX+KcpNXL+sX5Kxx/Mpw82vsmif 1ucQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IEm7m0QK; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6a1803df08f44-6b2a5b376f7si11621086d6.409.2024.06.13.03.44.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 13 Jun 2024 03:44:50 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IEm7m0QK; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sHhwU-0005b7-4O; Thu, 13 Jun 2024 06:44:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sHhwS-0005aa-MG for qemu-devel@nongnu.org; Thu, 13 Jun 2024 06:44:28 -0400 Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sHhwR-0003lL-1l for qemu-devel@nongnu.org; Thu, 13 Jun 2024 06:44:28 -0400 Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-a6f11a2d18aso112848166b.2 for ; Thu, 13 Jun 2024 03:44:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718275465; x=1718880265; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9bb2eJ+cyDtCSIGPEF3KqVqxXfOihaXK/Jl7Nmci3es=; b=IEm7m0QKwNqRAdgGf3g3MU9fwjH3MuZ1czncmcUUHrtl+pibdz5852pyqrei6GouKL tlBPvOe8lHFjNvIN5oPCuSBeCJHN5ww6SN4v6qCh6bCYxRNbuzs3fykJdvxXtstP0Fcx esWPiBP69LKyq87j2HHm5lDYyyz22Hn3bEeJnmYN1Mtw2KnsnjHOMU2zh8xLR6zQtRjL FpApOqg0gNzjRBnkhuY6S+qGMlx4+NG373mq194HIoUzUFAXIuRhLZLj02COpbhTiEeR CvDQU7H0wOCXrpBohmyZG3aftIxskUwJIsNKfU260cbcUcTKs9pCotTg3mCc18jiRLr5 6wJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718275465; x=1718880265; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9bb2eJ+cyDtCSIGPEF3KqVqxXfOihaXK/Jl7Nmci3es=; b=dgBoRKKV+macyE7uwSbE+E/yFcT9FS5/8WwWMx36W+YPbWHUyDKhV/Gu8ECEy3zUnx P3ZsyQPeCKHFwYwiwJuYHQrAgCGAsS8d9W2Yyv+vuH5YIE5FjUsMgmYRjM8QnFWj7ndy RSzcSNMfuHFNTC2gVlDAQ2jg+PpyXtw/kjsat3o2toMYUwUp4pH883zBNJe3r+x4SJOq V+YhsnBl0ikbKf56m55WKN7MJS1nyGHq6BjKNy1DrAu0GDluZsWPzjRXyvZXJJt5A9SN NkBkLNhEgAAn1AuBrUXPp3Nz/mdWgM+N4nW7LkLqOFOzdgueY+Ma8RtrJ/2waJP71Chj jRKg== X-Gm-Message-State: AOJu0YzP4G2qro7nBfy0YVQomRyqfVzNBFZUulARQYNxK0xDMZUo89Y1 Hp+9sWbcRauO70Q6OTQWi91ALzd0SthgUfeYVD1H7/vZKS952W/MdCAu5Kmz9evQkG61G/HQf9y 7 X-Received: by 2002:a17:906:489:b0:a6e:7e1f:2eae with SMTP id a640c23a62f3a-a6f4800b167mr270427666b.74.1718275465210; Thu, 13 Jun 2024 03:44:25 -0700 (PDT) Received: from m1x-phil.lan ([176.176.148.226]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a6f56ed0f2asm58863566b.131.2024.06.13.03.44.23 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 13 Jun 2024 03:44:24 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Eric Farman , Peter Maydell , Halil Pasic , Richard Henderson , David Hildenbrand , qemu-s390x@nongnu.org, Ilya Leoshkevich , Christian Borntraeger , Mark Cave-Ayland , Thomas Huth , Stefan Hajnoczi , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 1/2] hw/s390x: Introduce s390_skeys_get|set() helpers Date: Thu, 13 Jun 2024 12:44:14 +0200 Message-ID: <20240613104415.9643-2-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240613104415.9643-1-philmd@linaro.org> References: <20240613104415.9643-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::62f; envelope-from=philmd@linaro.org; helo=mail-ej1-x62f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org s390_skeys_set() dispatch to S390SKeysClass::set_skeys(), and s390_skeys_get() to S390SKeysClass::get_skeys(). Signed-off-by: Philippe Mathieu-Daudé --- include/hw/s390x/storage-keys.h | 10 ++++++++++ hw/s390x/s390-skeys.c | 27 +++++++++++++++++++++++++++ hw/s390x/trace-events | 4 ++++ 3 files changed, 41 insertions(+) diff --git a/include/hw/s390x/storage-keys.h b/include/hw/s390x/storage-keys.h index aa2ec2aae5..976ffb2039 100644 --- a/include/hw/s390x/storage-keys.h +++ b/include/hw/s390x/storage-keys.h @@ -111,6 +111,16 @@ struct QEMUS390SKeysState { }; void s390_skeys_init(void); +/** + * @s390_skeys_get: See S390SKeysClass::get_skeys() + */ +int s390_skeys_get(S390SKeysState *ks, uint64_t start_gfn, + uint64_t count, uint8_t *keys); +/** + * @s390_skeys_set: See S390SKeysClass::set_skeys() + */ +int s390_skeys_set(S390SKeysState *ks, uint64_t start_gfn, + uint64_t count, uint8_t *keys); S390SKeysState *s390_get_skeys_device(void); diff --git a/hw/s390x/s390-skeys.c b/hw/s390x/s390-skeys.c index 5c535d483e..bf22d6863e 100644 --- a/hw/s390x/s390-skeys.c +++ b/hw/s390x/s390-skeys.c @@ -23,6 +23,7 @@ #include "sysemu/kvm.h" #include "migration/qemu-file-types.h" #include "migration/register.h" +#include "trace.h" #define S390_SKEYS_BUFFER_SIZE (128 * KiB) /* Room for 128k storage keys */ #define S390_SKEYS_SAVE_FLAG_EOS 0x01 @@ -54,6 +55,32 @@ void s390_skeys_init(void) qdev_realize(DEVICE(obj), NULL, &error_fatal); } +int s390_skeys_get(S390SKeysState *ks, uint64_t start_gfn, + uint64_t count, uint8_t *keys) +{ + S390SKeysClass *kc = S390_SKEYS_GET_CLASS(ks); + int rc; + + rc = kc->get_skeys(ks, start_gfn, count, keys); + if (rc) { + trace_s390_skeys_get_nonzero(rc); + } + return rc; +} + +int s390_skeys_set(S390SKeysState *ks, uint64_t start_gfn, + uint64_t count, uint8_t *keys) +{ + S390SKeysClass *kc = S390_SKEYS_GET_CLASS(ks); + int rc; + + rc = kc->set_skeys(ks, start_gfn, count, keys); + if (rc) { + trace_s390_skeys_set_nonzero(rc); + } + return rc; +} + static void write_keys(FILE *f, uint8_t *keys, uint64_t startgfn, uint64_t count, Error **errp) { diff --git a/hw/s390x/trace-events b/hw/s390x/trace-events index 34da5ea323..4e74bf4484 100644 --- a/hw/s390x/trace-events +++ b/hw/s390x/trace-events @@ -36,3 +36,7 @@ s390_pci_unknown(const char *msg, uint32_t cmd) "%s unknown command 0x%x" s390_pci_bar(uint32_t bar, uint32_t addr, uint64_t size, uint32_t barsize) "bar %d addr 0x%x size 0x%" PRIx64 "barsize 0x%x" s390_pci_nodev(const char *cmd, uint32_t fh) "%s no pci dev fh 0x%x" s390_pci_invalid(const char *cmd, uint32_t fh) "%s invalid space fh 0x%x" + +# s390-skeys.c +s390_skeys_get_nonzero(int rc) "SKEY: Call to get_skeys unexpectedly returned %d" +s390_skeys_set_nonzero(int rc) "SKEY: Call to set_skeys unexpectedly returned %d" From patchwork Thu Jun 13 10:44:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 803866 Delivered-To: patch@linaro.org Received: by 2002:a5d:58c5:0:b0:35b:5a80:51b4 with SMTP id o5csp239898wrf; Thu, 13 Jun 2024 03:45:07 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWqViqwdr7pWyGPSi8BFh14+RK/7rf3KohSgUqiC7pCdlcZzepaxz6Nj0j5bG5m1LJv+aAshcHsUIaQdQAPcHcj X-Google-Smtp-Source: AGHT+IE1k02rd8eBrbsnXWMoFDUyyzuFqfFGSNdrm+WLMUddPslyWfEc5OoUSLXIb5/FidU3KQ1M X-Received: by 2002:a05:622a:11c2:b0:441:4184:17f3 with SMTP id d75a77b69052e-4415aca73abmr51269981cf.61.1718275507433; Thu, 13 Jun 2024 03:45:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1718275507; cv=none; d=google.com; s=arc-20160816; b=EAwV846g3ZmbLmseI/pWBqvj+2YVI9ZmtEgh3BsQ3gv5x8rXRR0CIxVY5fBBhqinIR nL50bOY/WlAKTy8/L8dy59Vsd3GhqUHwIwLW4dTlAH3OWRVxHNcpP04CJZIAUhiQgNU0 H5dU15Fv4zobrJT7nwZkeNKCq7qe5NWm58i0i4HEs84xxm9qywQArvhrqTrz27wQFcvD Yjj3akM8FOgjKiZ597VXvG3KQHzbzxn+ItUgJ1vcg3shAuX6JjlOJ3DVk4dJ5Y0bqCdc LC8k8NJHzKkRxiWvMHz4J1JbdO0LzPpbTyeLXW9QgJVWX9yWUF9NFSLEJTs6hKbEcykx 2lcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=sumL6TrGjbghTO5XOerJp+bSLYxh41etGSCXTjn7OMI=; fh=xBDq+vw2O4NzhKQlMCAv2ESMCrOs2fHGJ5yzjmHHQ6k=; b=u1LqnwV31GpIlcHqBwNbEwQRL3UBa5p5gTYnuLNxdIhoe52B4siOpHjFtWoc/icoEp vtY8Yn9OXmDmL1NAO29w9ccqVJnqgQKcSbnlU6nSAbi8NXqNML60OkednVgTSRFMXlPN BuJr+cZYJ1owagJtNugkMuP6XDWxHYSGej0IWEjaY8f95yAHIrJEC9+dcCCs0D7wLLod J79e5O+9jz1VuUt096e8ixMDuTDhWsgQPV1uBTGf/o+ZWsXMckL982wAnQEzZDLEJC4F dpkUpxZemFocj7QK951t9KBZHbRz+QINuiEdWmO5G1mwzYWbmzkdrrBHo0eidNs9b9rq v+OA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JWOSgHO5; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-441f3102b42si11165961cf.731.2024.06.13.03.45.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 13 Jun 2024 03:45:07 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JWOSgHO5; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sHhwb-0005tX-Tu; Thu, 13 Jun 2024 06:44:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sHhwZ-0005rA-A8 for qemu-devel@nongnu.org; Thu, 13 Jun 2024 06:44:35 -0400 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sHhwX-0003mI-Gf for qemu-devel@nongnu.org; Thu, 13 Jun 2024 06:44:35 -0400 Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-a6ef8e62935so116915966b.3 for ; Thu, 13 Jun 2024 03:44:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718275471; x=1718880271; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=sumL6TrGjbghTO5XOerJp+bSLYxh41etGSCXTjn7OMI=; b=JWOSgHO51At2ze4OeOqEGR+70/MhdBleQsIjCxfOD0pMiYIdXN3NLIY2My7YuZNJgr hr88ECtXODaLlOv8wzhoyyY5lP3H8L9iAPGcy/nMOXFKRE+yyOeHANjCKgXIlISgEyRz xu2WJDgLFuFeEi00cTS1KM9IoQcsgXJaQ9fvCXkILbtqTiDASePftwtruJpAwPI56onB XvshJxbuaaHpcXNJrBR5MwHyH4MGjiK66ceB4jNy2MkbtWGsZKNNr86sns7JIBlUh2Gg ZjVXUi3VYKgd8oEaCMnNIOI26+zrm+DJYHoDTu08cFZChNSt+wcsRexJVT+DMwXsCxaa lCXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718275471; x=1718880271; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sumL6TrGjbghTO5XOerJp+bSLYxh41etGSCXTjn7OMI=; b=O+gxVyhDas6oncdUBMNivIERhsTucGMzRymbyycPMGCjEZs9fww3NUIXvlDPM6kSOc aAUdJh3OEuBMumq1l+waztY+If/LYeANGV18F4oDoruVzeBUjdfSEQbbM7Y8qUTL2Q20 3Vbmg8RQn+Eyd5CKcyoLFSDB9YqOeVuZVclPW+F3bTgmOQZwGkq5EPK8mb4x0CNJWrbs BCDS/ssn3q9X38Vw9bv/zlRZxHco/4IGd9pWhZxlX1iOTjBDZgRc67gk+/GhWGZyMmQr X2b5bx2bZZIeuDfqsZ06vi35dNYU3CvrL5TOxk6s29E2QW0kcSXCsc+QkRYZdNv7GCj2 7/Yw== X-Gm-Message-State: AOJu0YzbZjY3pK5qusxR5bUR3OGkR4zuGfOn/dwmd/FcXKMjrrcMC6uY LeSQPhWjc//Ge54JWP6mwTRgdCRqL4aGTsNw8CQVS+2X28vo57OhH0vn81ZqKRrHs3yoz/1Mme1 Y X-Received: by 2002:a17:906:480a:b0:a6f:5f:8b7 with SMTP id a640c23a62f3a-a6f47f589cdmr354174066b.21.1718275471420; Thu, 13 Jun 2024 03:44:31 -0700 (PDT) Received: from m1x-phil.lan ([176.176.148.226]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a6f56f41721sm58272566b.154.2024.06.13.03.44.29 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 13 Jun 2024 03:44:30 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Eric Farman , Peter Maydell , Halil Pasic , Richard Henderson , David Hildenbrand , qemu-s390x@nongnu.org, Ilya Leoshkevich , Christian Borntraeger , Mark Cave-Ayland , Thomas Huth , Stefan Hajnoczi , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH v2 2/2] target/s390x: Use s390_skeys_get|set() helper Date: Thu, 13 Jun 2024 12:44:15 +0200 Message-ID: <20240613104415.9643-3-philmd@linaro.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240613104415.9643-1-philmd@linaro.org> References: <20240613104415.9643-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::630; envelope-from=philmd@linaro.org; helo=mail-ej1-x630.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Commit c9274b6bf0 ("target/s390x: start moving TCG-only code to tcg/") moved mem_helper.c, but the trace-events file is still in the parent directory, so is the generated trace.h. Call the s390_skeys_get|set() helper, removing the need for the trace event shared with the tcg/ sub-directory Signed-off-by: Philippe Mathieu-Daudé --- target/s390x/mmu_helper.c | 11 ++--------- target/s390x/tcg/mem_helper.c | 16 ++++------------ target/s390x/trace-events | 4 ---- 3 files changed, 6 insertions(+), 25 deletions(-) diff --git a/target/s390x/mmu_helper.c b/target/s390x/mmu_helper.c index f3a2f25a5c..6c59d0d216 100644 --- a/target/s390x/mmu_helper.c +++ b/target/s390x/mmu_helper.c @@ -25,7 +25,6 @@ #include "sysemu/tcg.h" #include "exec/exec-all.h" #include "exec/page-protection.h" -#include "trace.h" #include "hw/hw.h" #include "hw/s390x/storage-keys.h" #include "hw/boards.h" @@ -303,7 +302,6 @@ static void mmu_handle_skey(target_ulong addr, int rw, int *flags) static S390SKeysClass *skeyclass; static S390SKeysState *ss; uint8_t key, old_key; - int rc; /* * We expect to be called with an absolute address that has already been @@ -341,9 +339,7 @@ static void mmu_handle_skey(target_ulong addr, int rw, int *flags) * * TODO: we have races between getting and setting the key. */ - rc = skeyclass->get_skeys(ss, addr / TARGET_PAGE_SIZE, 1, &key); - if (rc) { - trace_get_skeys_nonzero(rc); + if (s390_skeys_get(ss, addr / TARGET_PAGE_SIZE, 1, &key)) { return; } old_key = key; @@ -371,10 +367,7 @@ static void mmu_handle_skey(target_ulong addr, int rw, int *flags) key |= SK_R; if (key != old_key) { - rc = skeyclass->set_skeys(ss, addr / TARGET_PAGE_SIZE, 1, &key); - if (rc) { - trace_set_skeys_nonzero(rc); - } + s390_skeys_set(ss, addr / TARGET_PAGE_SIZE, 1, &key); } } diff --git a/target/s390x/tcg/mem_helper.c b/target/s390x/tcg/mem_helper.c index 6a308c5553..6cdbc34178 100644 --- a/target/s390x/tcg/mem_helper.c +++ b/target/s390x/tcg/mem_helper.c @@ -30,7 +30,6 @@ #include "hw/core/tcg-cpu-ops.h" #include "qemu/int128.h" #include "qemu/atomic128.h" -#include "trace.h" #if !defined(CONFIG_USER_ONLY) #include "hw/s390x/storage-keys.h" @@ -2093,9 +2092,8 @@ uint64_t HELPER(iske)(CPUS390XState *env, uint64_t r2) } } - rc = skeyclass->get_skeys(ss, addr / TARGET_PAGE_SIZE, 1, &key); + rc = s390_skeys_get(ss, addr / TARGET_PAGE_SIZE, 1, &key); if (rc) { - trace_get_skeys_nonzero(rc); return 0; } return key; @@ -2108,7 +2106,6 @@ void HELPER(sske)(CPUS390XState *env, uint64_t r1, uint64_t r2) static S390SKeysClass *skeyclass; uint64_t addr = wrap_address(env, r2); uint8_t key; - int rc; addr = mmu_real2abs(env, addr); if (!mmu_absolute_addr_valid(addr, false)) { @@ -2124,10 +2121,7 @@ void HELPER(sske)(CPUS390XState *env, uint64_t r1, uint64_t r2) } key = r1 & 0xfe; - rc = skeyclass->set_skeys(ss, addr / TARGET_PAGE_SIZE, 1, &key); - if (rc) { - trace_set_skeys_nonzero(rc); - } + s390_skeys_set(ss, addr / TARGET_PAGE_SIZE, 1, &key); /* * As we can only flush by virtual address and not all the entries * that point to a physical address we have to flush the whole TLB. @@ -2157,18 +2151,16 @@ uint32_t HELPER(rrbe)(CPUS390XState *env, uint64_t r2) } } - rc = skeyclass->get_skeys(ss, addr / TARGET_PAGE_SIZE, 1, &key); + rc = s390_skeys_get(ss, addr / TARGET_PAGE_SIZE, 1, &key); if (rc) { - trace_get_skeys_nonzero(rc); return 0; } re = key & (SK_R | SK_C); key &= ~SK_R; - rc = skeyclass->set_skeys(ss, addr / TARGET_PAGE_SIZE, 1, &key); + rc = s390_skeys_set(ss, addr / TARGET_PAGE_SIZE, 1, &key); if (rc) { - trace_set_skeys_nonzero(rc); return 0; } /* diff --git a/target/s390x/trace-events b/target/s390x/trace-events index 729cb012b4..d371ef71b9 100644 --- a/target/s390x/trace-events +++ b/target/s390x/trace-events @@ -1,9 +1,5 @@ # See docs/devel/tracing.rst for syntax documentation. -# mmu_helper.c -get_skeys_nonzero(int rc) "SKEY: Call to get_skeys unexpectedly returned %d" -set_skeys_nonzero(int rc) "SKEY: Call to set_skeys unexpectedly returned %d" - # ioinst.c ioinst(const char *insn) "IOINST: %s" ioinst_sch_id(const char *insn, int cssid, int ssid, int schid) "IOINST: %s (%x.%x.%04x)"