From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (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 17F772EDD41 for ; Wed, 17 Sep 2025 14:34:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758119648; cv=none; b=A7QfEBQFVWpoSNaf1iYUiwv5KUdflhnvyk73u+QbuD0x0sy8pobGIrqFCKHOf3erRwSYkxCXCetx4t6a+2+6pom0F6qHi65KJcNNoL6ulgw3ETEkHlnFaQjLz4ut/5OS2FMxIPjOuPvxcZavqCOpeTgNnKZ6zLj5+e4CCSrSwLg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758119648; c=relaxed/simple; bh=G3bpYNVEi2nl5QeVgRL/v4dYydHbMFa1sJE7t1hn+Gk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=X3e6dSsYf094jucE7KAiI1zPKDUJEI2QZRFK3q+xCdi7We09Nm6nK1EIwl4b8hJhXLm/+4gUQjxENsvNYJoOdKKAsCHHHCAevKnB25pxxllrUUJwv5rYRyr/laTsAhaQVIKPLwK94uqmmyG78xvf4m+GqIiHMpo6sAdkzCnLA3M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.231]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4cRh3t1vnvz6L5B8; Wed, 17 Sep 2025 22:29:30 +0800 (CST) Received: from frapeml500008.china.huawei.com (unknown [7.182.85.71]) by mail.maildlp.com (Postfix) with ESMTPS id CE5A11400F4; Wed, 17 Sep 2025 22:34:02 +0800 (CST) Received: from SecurePC-101-06.huawei.com (10.122.19.247) by frapeml500008.china.huawei.com (7.182.85.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Wed, 17 Sep 2025 16:34:02 +0200 From: Jonathan Cameron To: Michael Tsirkin , , , Davidlohr Bueso CC: , Fan Ni , , , Ravi Shankar Subject: [PATCH qemu for 10.2 1/3] hw/cxl/cxl-mailbox-utils: Move declaration of scrub and ECS feature attributes in cmd_features_set_feature() Date: Wed, 17 Sep 2025 15:33:28 +0100 Message-ID: <20250917143330.294698-2-Jonathan.Cameron@huawei.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250917143330.294698-1-Jonathan.Cameron@huawei.com> References: <20250917143330.294698-1-Jonathan.Cameron@huawei.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: lhrpeml100009.china.huawei.com (7.191.174.83) To frapeml500008.china.huawei.com (7.182.85.71) From: Shiju Jose Move the declaration of scrub and ECS feature attributes in cmd_features_set_feature() to the local scope where they are used. Signed-off-by: Shiju Jose Signed-off-by: Jonathan Cameron --- hw/cxl/cxl-mailbox-utils.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/hw/cxl/cxl-mailbox-utils.c b/hw/cxl/cxl-mailbox-utils.c index 1f3982e89e..c05852836d 100644 --- a/hw/cxl/cxl-mailbox-utils.c +++ b/hw/cxl/cxl-mailbox-utils.c @@ -1351,10 +1351,6 @@ static CXLRetCode cmd_features_set_feature(const struct cxl_cmd *cmd, CXLCCI *cci) { CXLSetFeatureInHeader *hdr = (void *)payload_in; - CXLMemPatrolScrubWriteAttrs *ps_write_attrs; - CXLMemPatrolScrubSetFeature *ps_set_feature; - CXLMemECSWriteAttrs *ecs_write_attrs; - CXLMemECSSetFeature *ecs_set_feature; CXLSetFeatureInfo *set_feat_info; uint16_t bytes_to_copy = 0; uint8_t data_transfer_flag; @@ -1396,13 +1392,14 @@ static CXLRetCode cmd_features_set_feature(const struct cxl_cmd *cmd, } if (qemu_uuid_is_equal(&hdr->uuid, &patrol_scrub_uuid)) { + CXLMemPatrolScrubSetFeature *ps_set_feature = (void *)payload_in; + CXLMemPatrolScrubWriteAttrs *ps_write_attrs = + &ps_set_feature->feat_data; + if (hdr->version != CXL_MEMDEV_PS_SET_FEATURE_VERSION) { return CXL_MBOX_UNSUPPORTED; } - ps_set_feature = (void *)payload_in; - ps_write_attrs = &ps_set_feature->feat_data; - if ((uint32_t)hdr->offset + bytes_to_copy > sizeof(ct3d->patrol_scrub_wr_attrs)) { return CXL_MBOX_INVALID_PAYLOAD_LENGTH; @@ -1423,13 +1420,13 @@ static CXLRetCode cmd_features_set_feature(const struct cxl_cmd *cmd, } } else if (qemu_uuid_is_equal(&hdr->uuid, &ecs_uuid)) { + CXLMemECSSetFeature *ecs_set_feature = (void *)payload_in; + CXLMemECSWriteAttrs *ecs_write_attrs = ecs_set_feature->feat_data; + if (hdr->version != CXL_ECS_SET_FEATURE_VERSION) { return CXL_MBOX_UNSUPPORTED; } - ecs_set_feature = (void *)payload_in; - ecs_write_attrs = ecs_set_feature->feat_data; - if ((uint32_t)hdr->offset + bytes_to_copy > sizeof(ct3d->ecs_wr_attrs)) { return CXL_MBOX_INVALID_PAYLOAD_LENGTH; -- 2.48.1