Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 015D433E350 for ; Tue, 3 Feb 2026 12:04:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770120252; cv=none; b=hAUl1U96eGWKSJRb63o+fG0OWCW2PmIZkj/JnpRiCO4/HYxYBGKqHyNGOBElqEhJPixAdjb2qncZHKI6vYQSMdQd6LUuqSOsodEtMY1+abCHWQjmizILdbK2agwcnFh3c5XaElMl6YHrpgz0KDKUB1jxdne7dzTTAjpNYp3ywEU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770120252; c=relaxed/simple; bh=OIdmoa7YQ8cwxdw0odTKLrrxRcL7Ihfbf6TF8HrWjqQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=htwZAgUzeLjxIP1nQHxNDbmuHMwVyvQqESiuJzGQIkknAR/1hMCUWrN9A2pF+vCGi9y1BJ6imtUKdgWf4+tiX+ALKd9XCaW76HdIqqQERhuCiI1nc8yWN6XNZ9qWmtyXjAkjRnnOX8DEjpVViIFqwguLQsyeBWraMX2sr8GN4us= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=gz0zckKg; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="gz0zckKg" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1770120250; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JiiY6hdAG4pbuPdzjGdEJ5gQuntuGsJCEg5mBLcgkBI=; b=gz0zckKggqTZwazCXrtWKIxSvgH5qXfalch2yTvPukwNb0IPO7yT3SnMv/VbQhD/xLZzfv JoqdUc2P5H7Dx+8NDYvvdDoti1gWJVPxitrID+XRsNIK5fbuj98bdpHg2+wCO5EG/HB192 1VWPsX5NK82KIZSC+2qNTHlUQ8I8PFU= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-172-F-2lWMMIOTunCZmJ-JDT_g-1; Tue, 03 Feb 2026 07:04:06 -0500 X-MC-Unique: F-2lWMMIOTunCZmJ-JDT_g-1 X-Mimecast-MFC-AGG-ID: F-2lWMMIOTunCZmJ-JDT_g_1770120245 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6738F1956054; Tue, 3 Feb 2026 12:04:05 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.44.34.28]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DD8C81800947; Tue, 3 Feb 2026 12:04:04 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 7ED951826269; Tue, 03 Feb 2026 13:03:44 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Cc: Igor Mammedov , Paolo Bonzini , Marcel Apfelbaum , Ani Sinha , Pierrick Bouvier , Eduardo Habkost , Zhao Liu , Stefano Garzarella , Marcelo Tosatti , "Michael S. Tsirkin" , Richard Henderson , kvm@vger.kernel.org, Gerd Hoffmann , Oliver Steffen , Luigi Leonardi Subject: [PULL 14/17] igvm: Refactor qigvm_parameter_insert Date: Tue, 3 Feb 2026 13:03:39 +0100 Message-ID: <20260203120343.656961-15-kraxel@redhat.com> In-Reply-To: <20260203120343.656961-1-kraxel@redhat.com> References: <20260203120343.656961-1-kraxel@redhat.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 From: Oliver Steffen Use qigvm_find_param_entry() also in qigvm_parameter_insert(). This changes behavior: Processing now stops after the first parameter entry found. That is OK, because we expect only one matching entry anyway. Reviewed-by: Luigi Leonardi Signed-off-by: Oliver Steffen Message-ID: <20260130054714.715928-7-osteffen@redhat.com> Signed-off-by: Gerd Hoffmann --- backends/igvm.c | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/backends/igvm.c b/backends/igvm.c index ea3f9d6b008f..ffd1c325b661 100644 --- a/backends/igvm.c +++ b/backends/igvm.c @@ -476,31 +476,31 @@ static int qigvm_directive_parameter_insert(QIgvm *ctx, return 0; } - QTAILQ_FOREACH(param_entry, &ctx->parameter_data, next) - { - if (param_entry->index == param->parameter_area_index) { - region = qigvm_prepare_memory(ctx, param->gpa, param_entry->size, - ctx->current_header_index, errp); - if (!region) { - return -1; - } - memcpy(region, param_entry->data, param_entry->size); - g_free(param_entry->data); - param_entry->data = NULL; + param_entry = qigvm_find_param_entry(ctx, param->parameter_area_index); + if (param_entry == NULL) { + return 0; + } - /* - * If a confidential guest support object is provided then use it to - * set the guest state. - */ - if (ctx->cgs) { - result = ctx->cgsc->set_guest_state(param->gpa, region, - param_entry->size, - CGS_PAGE_TYPE_UNMEASURED, 0, - errp); - if (result < 0) { - return -1; - } - } + region = qigvm_prepare_memory(ctx, param->gpa, param_entry->size, + ctx->current_header_index, errp); + if (!region) { + return -1; + } + memcpy(region, param_entry->data, param_entry->size); + g_free(param_entry->data); + param_entry->data = NULL; + + /* + * If a confidential guest support object is provided then use it to + * set the guest state. + */ + if (ctx->cgs) { + result = ctx->cgsc->set_guest_state(param->gpa, region, + param_entry->size, + CGS_PAGE_TYPE_UNMEASURED, 0, + errp); + if (result < 0) { + return -1; } } return 0; -- 2.52.0