From patchwork Wed Jun 26 19:49:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 807510 Delivered-To: patch@linaro.org Received: by 2002:adf:e842:0:b0:362:4979:7f74 with SMTP id d2csp476659wrn; Wed, 26 Jun 2024 12:51:26 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVyQix3OTwGIEoBG6VRSSdvIZJbUeEfyfYfwF3ob6eUDCixWM0swZVRuBAd0vynAvXhFnBXmS+5AJwC6G3S25cy X-Google-Smtp-Source: AGHT+IGAQO9N55c+vuI4/mkGM7gGMUlzx2nnWdWqAdNyfFgHl/Hl7/j3eH1y3LYEXCo+8aA7soDu X-Received: by 2002:a05:620a:601a:b0:79b:ba64:fd6f with SMTP id af79cd13be357-79be471fda5mr1458838585a.40.1719431486547; Wed, 26 Jun 2024 12:51:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719431486; cv=none; d=google.com; s=arc-20160816; b=YsBa3+p4vUJqjeD/Y1EYhDVtkD0Dp7OAVb4d4uCalZLnyKnPxrJo88T8T2sI2+6gyA jWi/qOQWoxAQU5yq55EgEoRi0LHVQIONG3pb0Q8rm8mS+DnpACCNBnDZ11BmLfNLyVvC nIuna1gfpiOgQlvYxNBs4UBFdc4FWNNccPGsve1vp8Dqs9pfLsD0+pUWAiDUG2ZEFeYV PDTPbR4aNnBfC31zd+0LzvjqTbfI9SLJ0LjVHI+taetVn6polF9tFgx/kK/0rwisliOr Wvv0rjpRX1Yvy+Hw7cfv3PNdWS7mTkNVx9hMGu2TQbVYzDxplzN8hxxDALDQdJXqF6QG n/xw== 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=DfnhjluiI4IZZVonHBRb763w0QLa0hN07g2FgRNiqJE=; fh=YiKACOOGwOIKvy+G1clkODZYvBNJscfpNjsHDps50o0=; b=0TbrJKDIIHzvq0U1fEoJZAU9ImbR2T0yOSgRaoe6Mc90BtzA/kyUJhNRSJ5sFREbbt VSGjkRx4WyllccUaWhj4CjBGz8VubLpVZ7e2u1oX5c267SaPWNJY8qoV9RRaPB9MfQO7 IY+16EmAYzbPgjalzm0HwXKMCYNgCIdDGFvEJyZup1A9oEJdzCYNHV5cWZqDm63Mbugb xcn2IriCldMck1NvCKDyeKRR9qwiD0Pvvk7doTvD3MWD9z4lB8A/s8X7grx95U606g+d o1Kt6uzR66j9XTc/f1XuRnXnRBzQ61uQYsTgwRV7XfBuO8OTc/qhgtU6Q2mylmTF+7nt 4GNg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=z0O4ucgm; 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 af79cd13be357-79bcf511f6fsi1333237685a.66.2024.06.26.12.51.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 Jun 2024 12:51:26 -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=z0O4ucgm; 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 1sMYen-0007JR-T9; Wed, 26 Jun 2024 15:50:17 -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 1sMYem-0007JA-I2 for qemu-devel@nongnu.org; Wed, 26 Jun 2024 15:50:16 -0400 Received: from mail-pl1-x630.google.com ([2607:f8b0: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 1sMYeb-0002gl-2c for qemu-devel@nongnu.org; Wed, 26 Jun 2024 15:50:15 -0400 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1f9cd92b146so55801295ad.3 for ; Wed, 26 Jun 2024 12:49:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719431393; x=1720036193; 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=DfnhjluiI4IZZVonHBRb763w0QLa0hN07g2FgRNiqJE=; b=z0O4ucgmJMWI/vMHYTu/CKbp8qIlPSlWFrtX3TM/ioZCUgBCbQ9UztUP7+QFhLdOEn ly62gQOOpTmFp6kx08FNmgx2C4iLUmzDCFBXwAY4SsM7HLkYzBolj+i+xEVJ8xl0977y P4W9bDLw98d//hPWmLMzV85ZFH+m+9gwkzbJW7xyx0YMyFiIw6HKXwtaKBfJGv8WVrDa eOu9DdrGs5LGShqEJOBw+oJFwqymmVgxzBG3RXSHoDgZ4cbKVtIoj75oHDTswam9+GGv QIAvTFXA5qU8M9mMvDSbqY1DTabe7vL+GsYU+qYe+Y3GV4qh6ygatNCoF3CY1v2Lbvaw bFDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719431393; x=1720036193; 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=DfnhjluiI4IZZVonHBRb763w0QLa0hN07g2FgRNiqJE=; b=PLG65TOTiLsjJStMBfpIAlLxUak0B+An0Chf9bNuLNHhfsNk0OQvah0g96LLK+g4AC BVyzK/MTfUsyAZKvfEL0io5kZu119oPszsZQOWU+qrXmgQzn+/Gc9srXIpnvkEHS/lO+ sDccEu+HsWc1ykus6/gyZa7O2HqQ9GSczLQpFMzATGfDPQ+gjfEt92SQn+ofCltmcsqW H+VAIzCy+HH3hEXNFIfV53WOMJEfdSJ2LY+z5BtIYG4TESsRRCAAQdAmbcGCW1932y7y 96p/vPSHo7FEHjqJKjVwmGS5D7CIfcPmW+iSKowePSSCtKnAzd8BXu8nt7Z0B1ftzy50 zm/w== X-Gm-Message-State: AOJu0YxO1eCrGB3/7Y/lHYK8qvNTBtTUR5V3O3jXDe6HjPV3+6h/o/Gj AeZYPDxsC3M59rPNcvgeJ7fMvq4XFQjaRRptkYOniMI0y7OUOyX2qKLcNuxh4xlXNTKTq0KtoAq A X-Received: by 2002:a17:902:dac7:b0:1f9:a8c5:a288 with SMTP id d9443c01a7336-1fa1d62183amr143225975ad.37.1719431392818; Wed, 26 Jun 2024 12:49:52 -0700 (PDT) Received: from stoup.. (174-21-76-141.tukw.qwest.net. [174.21.76.141]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f9eb2f0318sm103734625ad.2.2024.06.26.12.49.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jun 2024 12:49:52 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, alex.bennee@linaro.org, berrange@redhat.com, philmd@linaro.org Subject: [PATCH 1/3] target/i386/sev: Cast id_auth_uaddr through uintptr_t Date: Wed, 26 Jun 2024 12:49:48 -0700 Message-Id: <20240626194950.1725800-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240626194950.1725800-1-richard.henderson@linaro.org> References: <20240626194950.1725800-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::630; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-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_PASS=-0.001, T_SPF_HELO_TEMPERROR=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 This member is __u64 in the kernel structure. Cast via uintptr_t to match the host's pointer size. Signed-off-by: Richard Henderson --- target/i386/sev.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/target/i386/sev.c b/target/i386/sev.c index 30b83f1d77..9dfdac69ab 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -2171,13 +2171,13 @@ sev_snp_guest_set_id_block(Object *obj, const char *value, Error **errp) finish->id_block_en = 0; g_free(sev_snp_guest->id_block); - g_free((guchar *)finish->id_block_uaddr); + g_free((void *)(uintptr_t)finish->id_block_uaddr); /* store the base64 str so we don't need to re-encode in getter */ sev_snp_guest->id_block = g_strdup(value); finish->id_block_uaddr = - (uint64_t)qbase64_decode(sev_snp_guest->id_block, -1, &len, errp); + (uintptr_t)qbase64_decode(sev_snp_guest->id_block, -1, &len, errp); if (!finish->id_block_uaddr) { return; @@ -2208,13 +2208,13 @@ sev_snp_guest_set_id_auth(Object *obj, const char *value, Error **errp) gsize len; g_free(sev_snp_guest->id_auth); - g_free((guchar *)finish->id_auth_uaddr); + g_free((void *)(uintptr_t)finish->id_auth_uaddr); /* store the base64 str so we don't need to re-encode in getter */ sev_snp_guest->id_auth = g_strdup(value); finish->id_auth_uaddr = - (uint64_t)qbase64_decode(sev_snp_guest->id_auth, -1, &len, errp); + (uintptr_t)qbase64_decode(sev_snp_guest->id_auth, -1, &len, errp); if (!finish->id_auth_uaddr) { return; From patchwork Wed Jun 26 19:49:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 807511 Delivered-To: patch@linaro.org Received: by 2002:adf:e842:0:b0:362:4979:7f74 with SMTP id d2csp476667wrn; Wed, 26 Jun 2024 12:51:27 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCV6pYwvQb3xAOENH7IfnSSi89BRmdJWtLnVvjDtRlIKINKQ9heSDKgqE4IgioIJCAzpdn4q+nYoccPkPge1Yv/p X-Google-Smtp-Source: AGHT+IHwwyIK3RimQEjzsE/R+njtrLesXyx21MvMsJd7LLr/kquNfsFxlirotxBV/LVfX+eLfk+e X-Received: by 2002:a05:620a:40cd:b0:795:47ca:d1e9 with SMTP id af79cd13be357-79be6ed68dbmr1210153085a.24.1719431487182; Wed, 26 Jun 2024 12:51:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719431487; cv=none; d=google.com; s=arc-20160816; b=Vlo/IDEaE8Cit4yng6HeNWCRDKBWB30MHNnYJTyvwZ5Ln1zy0RFsgt7iqicsmPV6c0 HG5wMnahf1CTaprPuwd56QoNG/C75USqKnhnvSZyUCwANbO81+4KvNcfVGXcBGi5f2Pl 3FXPc40bAMtjShQEiClyLntSmMrq/6dneJFcP4o3/n3OY3ZfKRD+0zeQt/Kuz9390VE/ kqM5v78aYHCwUe3b0W/ORoCBY+uq9NAqguaLuplXB6ikjTVhIhIl4efrd3xKeenzEmwX s2YJap8Tu7vZzDLJeCx5tYw7LiGkJ5qINWQWnOxke5ZG9zleGIAxLdhsUwV0smJQu225 jjoQ== 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=S99rf0kx9Z6i/Im5EEPLTtd6se1SVxvRu0Sq+1mhxcE=; fh=YiKACOOGwOIKvy+G1clkODZYvBNJscfpNjsHDps50o0=; b=YC0zcHyQCZD9KkvJk5f8yRXFqdrGOookWs1TBkUhMR2q0/OTVwOjlWJ9pfvWZqkIWo QvBi4SqEK+bY83vpWtAW6PIno2Re1lfgDRiw0jLrspq8uIHLDhFZlqjwhkjHaMPEbwGz 8zmKJJT1n01gCT/aZq4lOzu3kh9rkLnKHWVMIn776iOWMJjxFEp/z/n0k8kO0cZEYGhd n3R/6ZQ1PvRX0SW3EkK1MCR4QM//CzoEUw4nwxecpiSEMgjyxEy9zh2JAt21Or5oPs/6 HvHcxc/NNLtIpxuOdUpG7WlfiDbeiBqpEbiA6drH0IRo+lcU4oHUOmyWV5magubelDLL FWBA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="dGH/XXrH"; 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 af79cd13be357-79bce940b1fsi1382807185a.565.2024.06.26.12.51.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 Jun 2024 12:51:27 -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="dGH/XXrH"; 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 1sMYeq-0007K9-RJ; Wed, 26 Jun 2024 15:50:20 -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 1sMYeo-0007Jd-2R for qemu-devel@nongnu.org; Wed, 26 Jun 2024 15:50:18 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMYea-0002gu-5O for qemu-devel@nongnu.org; Wed, 26 Jun 2024 15:50:17 -0400 Received: by mail-pf1-x42c.google.com with SMTP id d2e1a72fcca58-7066a4a611dso3363110b3a.3 for ; Wed, 26 Jun 2024 12:49:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719431394; x=1720036194; 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=S99rf0kx9Z6i/Im5EEPLTtd6se1SVxvRu0Sq+1mhxcE=; b=dGH/XXrHGl+eFynL5BlooT+NXxyc5YmibuSWubzTtFQORN9vGBkHZNmhH+8b34ZcqO y1Pe0qGrRROFGrF3Y+k6LrY/Pd6jNhYtIJcuSwxYomfN+LK9DUwsRykbwBhO6pHb0Vnq 0CA3vFaGgJSRXzd6FE8EeeOb3xOnlWgXObB9Hvmju4sYDHKZ2u3sDWrcOZGlPLHWH6M8 ptffOMxcGUc6D73W1AM6k4eCLR66PKOSBskpMI98yvDCjIQFaRZxinKj5rGuy6eZjz+E JNXV8lDvTW7nbhW1dNdhir/sSHJN6R1vtVzigK3k+nKDb0rLkEM3bam/NXgyrc/1xsnu +n/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719431394; x=1720036194; 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=S99rf0kx9Z6i/Im5EEPLTtd6se1SVxvRu0Sq+1mhxcE=; b=RgOzV+0W4lUqs67XmKK2/LhkWNbg+8Y2A/7xBwuaKfqnlHLsk+NW0BkKCBr4I/QIW+ T9zwAzynA8DB38x2cy04c6h2VM4JdGCmmac4p7qgk/fm2swBMpqDQ4j09uAOCPOepNA1 pcHN6KIqdX4CyJCd2u0348aaewZDvInFSmudujS/QrlTeE+fnpkgnKvUJG9lMCixBoqj UWW+p999vyTQPG2isGpC6qUueQ+qy13Q08P56EFE7J2aGOh5NEk8kao6M5djq13chAjx IoS9CqQ1YyZxUfX1t5Ilx9qjIEZ29W8bOAHJ/nxjltoXuYzBjmvR+FO8K2C4SAgr+5yc WLuQ== X-Gm-Message-State: AOJu0YzBd47rqzTOSVC0y4fNEDfgyZ6QFt5goTxAqB52FCHdgfb126sR aYrt2IyYx4dkJPOq3FprxVooYkuFOJSF646CPEMcbH637CxzVOadPrSH4uiWodB7B/PKwIAl4Hs 7 X-Received: by 2002:a05:6a20:47e3:b0:1be:c4b9:c216 with SMTP id adf61e73a8af0-1bec4b9c416mr1447148637.7.1719431393735; Wed, 26 Jun 2024 12:49:53 -0700 (PDT) Received: from stoup.. (174-21-76-141.tukw.qwest.net. [174.21.76.141]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f9eb2f0318sm103734625ad.2.2024.06.26.12.49.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jun 2024 12:49:53 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, alex.bennee@linaro.org, berrange@redhat.com, philmd@linaro.org Subject: [PATCH 2/3] target/i386/sev: Use size_t for object sizes Date: Wed, 26 Jun 2024 12:49:49 -0700 Message-Id: <20240626194950.1725800-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240626194950.1725800-1-richard.henderson@linaro.org> References: <20240626194950.1725800-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42c; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42c.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, T_SPF_TEMPERROR=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 This code was using both uint32_t and uint64_t for len. Consistently use size_t instead. Signed-off-by: Richard Henderson --- target/i386/sev.c | 16 ++++++++-------- target/i386/trace-events | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/target/i386/sev.c b/target/i386/sev.c index 9dfdac69ab..f96301f81f 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -121,7 +121,7 @@ struct SevCommonStateClass { Error **errp); int (*launch_start)(SevCommonState *sev_common); void (*launch_finish)(SevCommonState *sev_common); - int (*launch_update_data)(SevCommonState *sev_common, hwaddr gpa, uint8_t *ptr, uint64_t len); + int (*launch_update_data)(SevCommonState *sev_common, hwaddr gpa, uint8_t *ptr, size_t len); int (*kvm_init)(ConfidentialGuestSupport *cgs, Error **errp); }; @@ -171,7 +171,7 @@ typedef struct SevLaunchUpdateData { QTAILQ_ENTRY(SevLaunchUpdateData) next; hwaddr gpa; void *hva; - uint64_t len; + size_t len; int type; } SevLaunchUpdateData; @@ -884,7 +884,7 @@ sev_snp_launch_update(SevSnpGuestState *sev_snp_guest, if (!data->hva || !data->len) { error_report("SNP_LAUNCH_UPDATE called with invalid address" - "/ length: %p / %lx", + "/ length: %p / %zx", data->hva, data->len); return 1; } @@ -943,7 +943,8 @@ out: } static int -sev_launch_update_data(SevCommonState *sev_common, hwaddr gpa, uint8_t *addr, uint64_t len) +sev_launch_update_data(SevCommonState *sev_common, hwaddr gpa, + uint8_t *addr, size_t len) { int ret, fw_error; struct kvm_sev_launch_update_data update; @@ -1088,8 +1089,7 @@ sev_launch_finish(SevCommonState *sev_common) } static int -snp_launch_update_data(uint64_t gpa, void *hva, - uint32_t len, int type) +snp_launch_update_data(uint64_t gpa, void *hva, size_t len, int type) { SevLaunchUpdateData *data; @@ -1106,7 +1106,7 @@ snp_launch_update_data(uint64_t gpa, void *hva, static int sev_snp_launch_update_data(SevCommonState *sev_common, hwaddr gpa, - uint8_t *ptr, uint64_t len) + uint8_t *ptr, size_t len) { int ret = snp_launch_update_data(gpa, ptr, len, KVM_SEV_SNP_PAGE_TYPE_NORMAL); @@ -1163,7 +1163,7 @@ sev_snp_cpuid_info_fill(SnpCpuidInfo *snp_cpuid_info, } static int -snp_launch_update_cpuid(uint32_t cpuid_addr, void *hva, uint32_t cpuid_len) +snp_launch_update_cpuid(uint32_t cpuid_addr, void *hva, size_t cpuid_len) { KvmCpuidInfo kvm_cpuid_info = {0}; SnpCpuidInfo snp_cpuid_info; diff --git a/target/i386/trace-events b/target/i386/trace-events index 06b44ead2e..51301673f0 100644 --- a/target/i386/trace-events +++ b/target/i386/trace-events @@ -6,7 +6,7 @@ kvm_memcrypt_register_region(void *addr, size_t len) "addr %p len 0x%zx" kvm_memcrypt_unregister_region(void *addr, size_t len) "addr %p len 0x%zx" kvm_sev_change_state(const char *old, const char *new) "%s -> %s" kvm_sev_launch_start(int policy, void *session, void *pdh) "policy 0x%x session %p pdh %p" -kvm_sev_launch_update_data(void *addr, uint64_t len) "addr %p len 0x%" PRIx64 +kvm_sev_launch_update_data(void *addr, size_t len) "addr %p len 0x%zx" kvm_sev_launch_measurement(const char *value) "data %s" kvm_sev_launch_finish(void) "" kvm_sev_launch_secret(uint64_t hpa, uint64_t hva, uint64_t secret, int len) "hpa 0x%" PRIx64 " hva 0x%" PRIx64 " data 0x%" PRIx64 " len %d" From patchwork Wed Jun 26 19:49:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 807509 Delivered-To: patch@linaro.org Received: by 2002:adf:e842:0:b0:362:4979:7f74 with SMTP id d2csp476660wrn; Wed, 26 Jun 2024 12:51:26 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXzFx+7V5R8gKvQBTIKCqST9Gb4XQDYVm25C6iY3k9ZFGn9DGe5vws8NPq5/PkW1+d8dHZaxJJ3eANdrx3ktm73 X-Google-Smtp-Source: AGHT+IGrfqMgoBChICYJBu9ubluacjwttQBeMKTCGUVirs0jdfCDYj7zEA+WXs3veJJ+z14YYIxg X-Received: by 2002:a05:620a:4485:b0:79d:5563:ea4f with SMTP id af79cd13be357-79d59f22e61mr100700085a.2.1719431486632; Wed, 26 Jun 2024 12:51:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1719431486; cv=none; d=google.com; s=arc-20160816; b=s8CXn1O31psgqFB4NogFr5n34JYZrEVMRHYOyjVwoCjtf1od1Y8cf7p803eKz99Mvf GlNRNRj3p9oiAf7Ub8iOqfaegX/m6CkJjdGKc+N1NK9Oj57dFP/K1WaEaq/odtLonkU2 dssCbgO5bdyaG+W3g0q0FxoCfjBDeYgab7+PmG/c8A5BrEE6ViGwlye3CGWDNje23O67 K1QiUWCBSec/+o+KsvooK3irwaklRQymVOQQ3P+XEaiprE1wgb7oKExaDTBjZatsUfq5 tTEP0Oq6hCClBq4L7mTlmRTqbWK90S+1X9nGk7buiWBfJ2MkeGGl/IRqgH6b4FVu4Yx/ dQnQ== 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=2vMo3UlLl6VRZdyC9VDGZj9tzgWdSUl3nVhPo3xSdwU=; fh=YiKACOOGwOIKvy+G1clkODZYvBNJscfpNjsHDps50o0=; b=RgBgXSk7XNT0pMAtNc/SQptU0KoL4jvpllGAff8MBUCXwajgT6UpGilTnOeRTVGhHn XRD57CpTInwNr7cjKsPpB/JIHr7q7e/suhHnuKldE35SANrtGuEJ2x371WgtqEnECRME 1T84QpqEYIJFfMj9zXL/15Lsn5ympsSz7FOPBbczBM0VZ6XhtspPTaJ8ZXkvEH9Iw35I W0T5bjhafRdzOzu3yuF7Rc1Eq6GqrzVb9A2I30RBXqLI010Q0TQb1Ur+5H3DSmkxCVhw c6xcUPrZjPgR/eOt7WUIdKBoAKdj3AxKOnkvwX0inLUppH6xp8BNo5hAZSlgvp8p+Oxj DvqA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YLkr1d7D; 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 af79cd13be357-79bce882acbsi1420212485a.51.2024.06.26.12.51.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 Jun 2024 12:51:26 -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=YLkr1d7D; 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 1sMYeu-0007Kx-GY; Wed, 26 Jun 2024 15:50:24 -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 1sMYeo-0007Jg-8I for qemu-devel@nongnu.org; Wed, 26 Jun 2024 15:50:18 -0400 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sMYea-0002gx-0E for qemu-devel@nongnu.org; Wed, 26 Jun 2024 15:50:16 -0400 Received: by mail-pg1-x535.google.com with SMTP id 41be03b00d2f7-6e7e23b42c3so4398433a12.1 for ; Wed, 26 Jun 2024 12:49:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719431395; x=1720036195; 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=2vMo3UlLl6VRZdyC9VDGZj9tzgWdSUl3nVhPo3xSdwU=; b=YLkr1d7DHIdGWi5IRzaGTBwuffiwWStXzo5TKaXy+rJGHO+UXh4z7SQqw6SBqeYElj Syt73TgdySianV37fIrzKKr/XqQwxAUdZzSkFA5sRVrlAS5vYqzei0+k1bf70J879JiW Y+PQmt+APdC76kF3F10I1txXmoNuj3Ue0F8J5/rJfWxDp55zAyBbbm83Y7hmhjbS2PcF AnbyETkwX466sryNZ6nA8TAoZRGQVayDjSc9g3CbIQREbeLNjC6auFa5zIHewC5SmqeI bqf7WHyPf9qMeLsIVEafAnXZ3axLKiUr5jGxKIBZlUS/ED0l+n7l9+1Svfs1bkv5HgmF 7wWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719431395; x=1720036195; 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=2vMo3UlLl6VRZdyC9VDGZj9tzgWdSUl3nVhPo3xSdwU=; b=n1pOmQDym0RYIYnyeXh/E+0JKesDiJvC46yyM5FYAMa08LWCxoy4LV5X/kLakhlKiG NSm0SBUnFVLMHFgTkZTekYUwHgsMZGsklQQxVN4p1+yKnnHu+Md332FGi7AKKDEQrndK k1GMXimBttqNnYsL6/oKIPUKIqwykuqX+N3xMdPKj2S+4+5OI8FWpC3zA+tUoOoG7Q6s 4nWA+jcQxYLJp4iiZYS+3zT13hXvlU6FYpzcXAecnqW56Vg9mHrIcTZWSAah/2/hd1nI 5gS26JGDlZNxI2ybCkWuaK2HSr28Ni9dvBEfyLFSZmCP4iT3uCY0481mOHs+WSTgzBjX EJtw== X-Gm-Message-State: AOJu0YxLzXxDvryO8+xLeSIB8l8YuUYu13haBjGwh/cwoWuakJZIrnnc TPakDczQJonEh7tKBcKm12kgeg9buKL+xFpInp5uxUAGGQP+lB5oFptR5M6vAhEkJX1jnBSGHJ9 G X-Received: by 2002:a05:6a20:bf02:b0:1bd:272c:d17c with SMTP id adf61e73a8af0-1bd272cd2ffmr4267989637.12.1719431394810; Wed, 26 Jun 2024 12:49:54 -0700 (PDT) Received: from stoup.. (174-21-76-141.tukw.qwest.net. [174.21.76.141]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f9eb2f0318sm103734625ad.2.2024.06.26.12.49.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jun 2024 12:49:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, alex.bennee@linaro.org, berrange@redhat.com, philmd@linaro.org Subject: [PATCH 3/3] target/i386/sev: Fix printf formats Date: Wed, 26 Jun 2024 12:49:50 -0700 Message-Id: <20240626194950.1725800-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240626194950.1725800-1-richard.henderson@linaro.org> References: <20240626194950.1725800-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::535; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x535.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, T_SPF_TEMPERROR=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 hwaddr uses HWADDR_PRIx, sizeof yields size_t so uses %zu, and gsize uses G_GSIZE_FORMAT. Signed-off-by: Richard Henderson --- target/i386/sev.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/target/i386/sev.c b/target/i386/sev.c index f96301f81f..74ed9948ca 100644 --- a/target/i386/sev.c +++ b/target/i386/sev.c @@ -932,8 +932,9 @@ sev_snp_launch_update(SevSnpGuestState *sev_snp_guest, out: if (!ret && update.gfn_start << TARGET_PAGE_BITS != data->gpa + data->len) { - error_report("SEV-SNP: expected update of GPA range %lx-%lx," - "got GPA range %lx-%llx", + error_report("SEV-SNP: expected update of GPA range %" + HWADDR_PRIx "-%" HWADDR_PRIx "," + "got GPA range %" HWADDR_PRIx "-%llx", data->gpa, data->gpa + data->len, data->gpa, update.gfn_start << TARGET_PAGE_BITS); ret = -EIO; @@ -2146,7 +2147,8 @@ sev_snp_guest_set_guest_visible_workarounds(Object *obj, const char *value, } if (len != sizeof(start->gosvw)) { - error_setg(errp, "parameter length of %lu exceeds max of %lu", + error_setg(errp, "parameter length of %" G_GSIZE_FORMAT + " exceeds max of %zu", len, sizeof(start->gosvw)); return; } @@ -2184,7 +2186,8 @@ sev_snp_guest_set_id_block(Object *obj, const char *value, Error **errp) } if (len != KVM_SEV_SNP_ID_BLOCK_SIZE) { - error_setg(errp, "parameter length of %lu not equal to %u", + error_setg(errp, "parameter length of %" G_GSIZE_FORMAT + " not equal to %u", len, KVM_SEV_SNP_ID_BLOCK_SIZE); return; } @@ -2221,7 +2224,8 @@ sev_snp_guest_set_id_auth(Object *obj, const char *value, Error **errp) } if (len > KVM_SEV_SNP_ID_AUTH_SIZE) { - error_setg(errp, "parameter length:ID_AUTH %lu exceeds max of %u", + error_setg(errp, "parameter length:ID_AUTH %" G_GSIZE_FORMAT + " exceeds max of %u", len, KVM_SEV_SNP_ID_AUTH_SIZE); return; } @@ -2287,7 +2291,8 @@ sev_snp_guest_set_host_data(Object *obj, const char *value, Error **errp) } if (len != sizeof(finish->host_data)) { - error_setg(errp, "parameter length of %lu not equal to %lu", + error_setg(errp, "parameter length of %" G_GSIZE_FORMAT + " not equal to %zu", len, sizeof(finish->host_data)); return; }