From patchwork Wed Feb 12 12:36:50 2025 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: 864452 Delivered-To: patch@linaro.org Received: by 2002:a5d:4cc5:0:b0:38f:210b:807b with SMTP id c5csp95356wrt; Wed, 12 Feb 2025 04:39:11 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWy3yVLt12Ni6RUySaK5zwxwmn1Uks3GUW/PrRdUEj7SA4dQ5kdqgVIHatk5VqSWJ/wpXLYRw==@linaro.org X-Google-Smtp-Source: AGHT+IE+Ve5bYnsz5nzoXjjGb/UoKcbiNwJWIBcEO7BFkDJhTl/xp0Bt9NPaSr0MibbXaGCyVUp8 X-Received: by 2002:a05:622a:1356:b0:471:89dc:2cf with SMTP id d75a77b69052e-471b06086e1mr40911241cf.1.1739363951408; Wed, 12 Feb 2025 04:39:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1739363951; cv=none; d=google.com; s=arc-20240605; b=NfMz7Nt60T5X96NukB6t9g7k4GAwsgsy1kAYfO+364Lzj8lJTZ0Xu28d6bOBf3tyS2 8msQJSahJLsgZRABH1OoDepEVkjP1zEN4OS/COyvkVbRmqByNqdH2Xzd8OOLxcl902Gv TKbRJi+JjGzXwKBdmo2EIat5hKEVSuR19R1vrHcE36XrLH7hXoSgzsAiJMhJ2NIVNa9K B1ZTlN3yjiXKBiQD/69wBHrRySKEPZgcmlj2tTtE2uTkqIG5E0X/ewFAuPrgcoIqxMl4 kdSmbxclYkKYMI68X5fDy+RYcwd+leaEJRwDpudouUqojNNddt+AEyibGvPkXEvuB8bO cT6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=cvDaF3GKG76GRCi7eSTTtcTkqo3eY1cM/gGguFUqtkI=; fh=HlENWry5pBMj1xy+XPJJKz1+KJ8prrg3FvBcv7/VjNo=; b=lMVndmgB7atwOMa0lPfi/6LpqnfsFxn+WUixvYAx9qBr3uXm1psVJIwqDmfYjEwF8a 5So5zwbG37xYjW0XY9fCuOKPrxaRv3pP10J7pBFP0J/JkieqaO9Pxxwp2ev0tqDJq1cC WPuQRehA8zxsGCZjAoKww2wa10vjs5KL2BkJJKyKtm4rO31G6CdDV2MG8co/IXSqqNqT FejdbsAW710SrdDN96Vgp1iiJhonHpMP4ZqLU4g64hw0TGUhvk0SQdy4OGBpEPKLeygq VUtk3UzUI0azEyQO3Wm57I6hEiRVIXzTX2RiK3gXhp33djwTRGYPMzwQ+dI9MFKAcVT0 yFFg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hk6EH+Bq; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-47194f52772si62696481cf.483.2025.02.12.04.39.11 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 12 Feb 2025 04:39:11 -0800 (PST) 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=hk6EH+Bq; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tiC0F-0003yl-9G; Wed, 12 Feb 2025 07:38:07 -0500 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 1tiBzW-0003RB-FW for qemu-devel@nongnu.org; Wed, 12 Feb 2025 07:37:23 -0500 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tiBzN-0000Ow-F2 for qemu-devel@nongnu.org; Wed, 12 Feb 2025 07:37:16 -0500 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-4394829ef0fso4937655e9.0 for ; Wed, 12 Feb 2025 04:37:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1739363826; x=1739968626; 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=cvDaF3GKG76GRCi7eSTTtcTkqo3eY1cM/gGguFUqtkI=; b=hk6EH+Bqi0lq4psoQrxuSFd5s7/MjK95JhOzeIMIJYgf8vy2oBQZZ17ZPuUQoq2Gc5 N/6DjVJx1KYnUqJSrJnvmnrRdHw0qB6Ow6W+kWaxiUiz5WDw+s9ZdNDEUXfZiLw3OodG czpiMM6Br/UAkhzkHLDE4EbQIVRbCSX0+D4y0ousgz3+4OonsnQhxdQ79R15oU+5zDSt 8XSbR2IVDzOVbyZ5Q+tQT0c0KHOVdX36Ksxhw7mZbc4V2TZCHv3CpWPrrRFCNIoAxHUt 4prUIAIR/XDuKqV7O9dO9glJBIx44BkLPf+28nIIWZ/oUhxi+Gqi24n+eVrXtl6+ouk4 fRaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739363826; x=1739968626; 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=cvDaF3GKG76GRCi7eSTTtcTkqo3eY1cM/gGguFUqtkI=; b=MEs3q0tWCzbivHS5soV1Bvd9ZkW3RY5RQ6CQ3omshByqsUp1tClKo/6plU9IWUUOTt 7HXA0QZa1vv20uXJc+YI4VmWNiIhrMReJYMgNhLneYyQrGKEsSLlXV0zAeka8LrdL+of 06jic3J2D25Id2/+iL43cDe2EgUaqTGM/UUCGzCR9ogzLLmChNRCWUzdk2PQKN4ldmse JMD5Ce3YUTLHhrHH+Y1efi+1NtrNl4l+IE7IjwoXtL+CWFfRfPP0/vk0iOPfzdqHhREl okGDMU7W0ryH2H5RyEBv+4nYIlzqF7nUmUIs2iP/0NN7zyzxgiOsbA79vg40lqtCUCi7 5+gA== X-Gm-Message-State: AOJu0Yyu7tfiSYDeWZ4J0F5EL5YX/vOwt3d9lApgz47Vdq+k8tjju+CM Q/3+1mMIVlYXeSWbOoG1KnUr5+DZmBBJrqgSPq5DE8r4Yyu/o1oeK6CDNnac6SzT5NdtxHjUti2 9lVk= X-Gm-Gg: ASbGncsoWLmMhMcBB5Pt8SZdt0fS30FdItT2dNQPlzDRqR0kRwKzm4iISvYmHHTgKLD KQZvFz7QkxXGzJRY+G02va//Wb/JTHn1rqJzpLOq13uercCSPkPv7XcnnQpikiU86POeRi95k1M 3Naljk9h6wzyK+xgEEUZ12FslGI6FdldzMnnJmPhvwrUrne05s6vbpH5x55axKrCtczn7YlGYPr bN7GpZUj+YT3Ft15VAX9xq4K0ZphJSdi3PJbiMk1niJmqutG68dB1k0U0wWjHVaSzgI7Ty3lmaN E3LAwY/TUcURKDg647Ha/+mmKJYixxtvqcgDK9UM2KTEMraNvxsW8R15hdgTcNEpoA== X-Received: by 2002:a05:600c:1508:b0:439:5b5c:e03b with SMTP id 5b1f17b1804b1-4395b5ce0d2mr15307345e9.6.1739363826533; Wed, 12 Feb 2025 04:37:06 -0800 (PST) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4395a04f208sm18657015e9.6.2025.02.12.04.37.05 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 12 Feb 2025 04:37:06 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: qemu-riscv@nongnu.org, Thomas Huth , qemu-arm@nongnu.org, Richard Henderson , qemu-ppc@nongnu.org, Sai Pavan Boddu , Markus Armbruster , "Edgar E. Iglesias" , Alistair Francis , =?utf-8?q?Daniel_P=2E_Berrang?= =?utf-8?q?=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= Subject: [PATCH v7 01/10] hw/qdev-properties-system: Introduce EndianMode QAPI enum Date: Wed, 12 Feb 2025 13:36:50 +0100 Message-ID: <20250212123659.52764-2-philmd@linaro.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250212123659.52764-1-philmd@linaro.org> References: <20250212123659.52764-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=philmd@linaro.org; helo=mail-wm1-x336.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 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 Introduce the EndianMode type and the DEFINE_PROP_ENDIAN() macros. Endianness can be BIG, LITTLE or unspecified (default). Reviewed-by: Thomas Huth Signed-off-by: Philippe Mathieu-Daudé --- qapi/common.json | 16 ++++++++++++++++ include/hw/qdev-properties-system.h | 7 +++++++ hw/core/qdev-properties-system.c | 11 +++++++++++ 3 files changed, 34 insertions(+) diff --git a/qapi/common.json b/qapi/common.json index 6ffc7a37890..33d8df19f67 100644 --- a/qapi/common.json +++ b/qapi/common.json @@ -212,3 +212,19 @@ ## { 'struct': 'HumanReadableText', 'data': { 'human-readable-text': 'str' } } + +## +# @EndianMode: +# +# An enumeration of three options: little, big, and unspecified +# +# @unspecified: Endianness not specified +# +# @little: Little endianness +# +# @big: Big endianness +# +# Since: 10.0 +## +{ 'enum': 'EndianMode', + 'data': [ 'unspecified', 'little', 'big' ] } diff --git a/include/hw/qdev-properties-system.h b/include/hw/qdev-properties-system.h index 7ec37f6316c..ead4dfc2f02 100644 --- a/include/hw/qdev-properties-system.h +++ b/include/hw/qdev-properties-system.h @@ -30,6 +30,7 @@ extern const PropertyInfo qdev_prop_pcie_link_speed; extern const PropertyInfo qdev_prop_pcie_link_width; extern const PropertyInfo qdev_prop_cpus390entitlement; extern const PropertyInfo qdev_prop_iothread_vq_mapping_list; +extern const PropertyInfo qdev_prop_endian_mode; #define DEFINE_PROP_PCI_DEVFN(_n, _s, _f, _d) \ DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_pci_devfn, int32_t) @@ -97,4 +98,10 @@ extern const PropertyInfo qdev_prop_iothread_vq_mapping_list; DEFINE_PROP(_name, _state, _field, qdev_prop_iothread_vq_mapping_list, \ IOThreadVirtQueueMappingList *) +#define DEFINE_PROP_ENDIAN(_name, _state, _field, _default) \ + DEFINE_PROP_UNSIGNED(_name, _state, _field, _default, \ + qdev_prop_endian_mode, EndianMode) +#define DEFINE_PROP_ENDIAN_NODEFAULT(_name, _state, _field) \ + DEFINE_PROP_ENDIAN(_name, _state, _field, ENDIAN_MODE_UNSPECIFIED) + #endif diff --git a/hw/core/qdev-properties-system.c b/hw/core/qdev-properties-system.c index a96675beb0d..89f954f569e 100644 --- a/hw/core/qdev-properties-system.c +++ b/hw/core/qdev-properties-system.c @@ -1283,3 +1283,14 @@ const PropertyInfo qdev_prop_iothread_vq_mapping_list = { .set = set_iothread_vq_mapping_list, .release = release_iothread_vq_mapping_list, }; + +/* --- Endian modes */ + +const PropertyInfo qdev_prop_endian_mode = { + .name = "EndianMode", + .description = "Endian mode, big/little/unspecified", + .enum_table = &EndianMode_lookup, + .get = qdev_propinfo_get_enum, + .set = qdev_propinfo_set_enum, + .set_default_value = qdev_propinfo_set_default_value_enum, +};