From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 51AF1E6F06F for ; Fri, 1 Nov 2024 17:39:19 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t6vc9-0004FY-Bk; Fri, 01 Nov 2024 13:39:13 -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 1t6vbg-0003dd-8D for qemu-riscv@nongnu.org; Fri, 01 Nov 2024 13:38:50 -0400 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t6vbe-00010q-FV for qemu-riscv@nongnu.org; Fri, 01 Nov 2024 13:38:43 -0400 Received: by mail-pj1-x102c.google.com with SMTP id 98e67ed59e1d1-2e2bb1efe78so1623527a91.1 for ; Fri, 01 Nov 2024 10:38:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1730482720; x=1731087520; darn=nongnu.org; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id:from:to :cc:subject:date:message-id:reply-to; bh=CV1Y7oANaxQ/a/o/wO72sx3sFIO+Sg75sDPCy70s1F0=; b=B200mO7YeefXYFjmANzE/LH5gloJ1NugtrBJkGZA/uOABL+G38G29B3v7UnOKtmBHh 6NhHSoCjmUubwjR1RIFxvmnaMpVv0BrySOvA2FiPniNdw/fxBGxExJwKUEUL155pNGuH D5+nf17okcebIpOzo4fE8Xsiu8SYf9f6eiPKHk4uBeZZCx/Wa2UeYW5TKMRop3IzzzaM 4FhtqlEPCfOBmimPKSjID28NULIId9QQBtBe7NKhTpv7c83xgMH5KEUe92p2p7zfVjhU kDBcDBOiLGjYsOTr/D/DDK9QtfQCBA5qUQjcFFKrouh+yO29gjWdI+tpwAvbCsvbKd6j 1C9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730482720; x=1731087520; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:from:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=CV1Y7oANaxQ/a/o/wO72sx3sFIO+Sg75sDPCy70s1F0=; b=Obkuhhoj/Nf78gLFBhzWR3HaPsTvyXdOsSQKcooqQb00CbihFeXiqGytOJa/1dXSfd OirsL0k8VCAxSsXVXVG0Q3SPopYDTF6Bq0LGJdwTzFApLmhZCZZyH4dgMEHAE0Hqvzka B2wfsRVIUJW4xxOonJhpSsp51EEKvpKB9WticuWB8g5kK0KKp80dtHiJ7Y1w/OZOfQOD gzlJJ4rugzRgSZxGhy6NxSSPYRKVJs+7vDpYM4Lm8+nBHdmTxzq+7aJUcr3J/FfIJU+X JcDLNZyhxEDAQN+QT8PrXZWXGImXKSLr6F8Dje2FhmbULIY9b+wiuslLIeFEezB575p0 EU7w== X-Forwarded-Encrypted: i=1; AJvYcCWTBKNSf9mqNgfwXOH35ghtQCgaBPBJqZhPrQrby8lplg83NfZ4CLGscFdHY1CD6wI26JbnkBn5h9jt@nongnu.org X-Gm-Message-State: AOJu0YzLetlI/Z1RI82Q2n5e6XrM6e8mcB/e/5tZHQkE04/mfIBCva3H k7VrqAlBspul1uu1vdvATUeZRsOux5q2jMiCQi5fDe+XgzYOE3UYKS928srL5fQ= X-Google-Smtp-Source: AGHT+IFhevH29oI++rAyxIbCQcIg0+d51miWzjkKcHNe+v81Lhn+lk1invs5Beh4fVWJ/hgHcp8Ylg== X-Received: by 2002:a17:90b:1d89:b0:2e1:8a41:aaba with SMTP id 98e67ed59e1d1-2e94c23325emr6763242a91.19.1730482720607; Fri, 01 Nov 2024 10:38:40 -0700 (PDT) Received: from [192.168.68.110] ([191.8.109.222]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e93db186bcsm3294118a91.46.2024.11.01.10.38.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 01 Nov 2024 10:38:40 -0700 (PDT) Message-ID: Date: Fri, 1 Nov 2024 14:38:33 -0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] hw/riscv: fix build error with clang From: Daniel Henrique Barboza To: Pierrick Bouvier , qemu-devel@nongnu.org Cc: Cleber Rosa , qemu-riscv@nongnu.org, Liu Zhiwei , Mahmoud Mandour , Alistair Francis , John Snow , Stefano Garzarella , Thomas Huth , =?UTF-8?Q?Marc-Andr=C3=A9_Lureau?= , "Michael S. Tsirkin" , Weiwei Li , =?UTF-8?Q?Philippe_Mathieu-Daud=C3=A9?= , Konstantin Kostiuk , Bin Meng , Paolo Bonzini , Alexandre Iooss , Michael Roth , =?UTF-8?Q?Alex_Benn=C3=A9e?= , =?UTF-8?Q?Daniel_P=2E_Berrang=C3=A9?= , Palmer Dabbelt References: <20241101170833.1074954-1-pierrick.bouvier@linaro.org> <2e1af830-a90a-447f-ab47-1c3d49463134@ventanamicro.com> Content-Language: en-US In-Reply-To: <2e1af830-a90a-447f-ab47-1c3d49463134@ventanamicro.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=dbarboza@ventanamicro.com; helo=mail-pj1-x102c.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-riscv@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-riscv-bounces+qemu-riscv=archiver.kernel.org@nongnu.org Sender: qemu-riscv-bounces+qemu-riscv=archiver.kernel.org@nongnu.org On 11/1/24 2:35 PM, Daniel Henrique Barboza wrote: > > > On 11/1/24 2:08 PM, Pierrick Bouvier wrote: >> Introduced in 0c54ac, "hw/riscv: add RISC-V IOMMU base emulation" >> >> ../hw/riscv/riscv-iommu.c:187:17: error: redefinition of '_pext_u64' >> >>    187 | static uint64_t _pext_u64(uint64_t val, uint64_t ext) >> >>        |                 ^ >> >> D:/a/_temp/msys64/clang64/lib/clang/18/include/bmi2intrin.h:217:1: note: previous definition is here >> >>    217 | _pext_u64(unsigned long long __X, unsigned long long __Y) >> >>        | ^ >> >> Signed-off-by: Pierrick Bouvier I think you can also add a Fixes: 0c54acb824 ("hw/riscv: add RISC-V IOMMU base emulation") >> --- >>   hw/riscv/riscv-iommu.c | 4 ++-- >>   1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/hw/riscv/riscv-iommu.c b/hw/riscv/riscv-iommu.c >> index feb650549ac..f738570bac2 100644 >> --- a/hw/riscv/riscv-iommu.c >> +++ b/hw/riscv/riscv-iommu.c >> @@ -184,7 +184,7 @@ static void riscv_iommu_pri(RISCVIOMMUState *s, >>   } >>   /* Portable implementation of pext_u64, bit-mask extraction. */ >> -static uint64_t _pext_u64(uint64_t val, uint64_t ext) >> +static uint64_t pext_u64(uint64_t val, uint64_t ext) > > I suggest name it 'riscv_iommu_pext_u64' to be clear that this is a local scope function, > not to be mistaken with anything available in clang or any other compiler. > > > Thanks, > > Daniel > >>   { >>       uint64_t ret = 0; >>       uint64_t rot = 1; >> @@ -528,7 +528,7 @@ static MemTxResult riscv_iommu_msi_write(RISCVIOMMUState *s, >>       int cause; >>       /* Interrupt File Number */ >> -    intn = _pext_u64(PPN_DOWN(gpa), ctx->msi_addr_mask); >> +    intn = pext_u64(PPN_DOWN(gpa), ctx->msi_addr_mask); >>       if (intn >= 256) { >>           /* Interrupt file number out of range */ >>           res = MEMTX_ACCESS_ERROR;