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 X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE079C433DF for ; Thu, 23 Jul 2020 02:19:25 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 9BDD7206F4 for ; Thu, 23 Jul 2020 02:19:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=sifive.com header.i=@sifive.com header.b="RjzMqc/v" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9BDD7206F4 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sifive.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:47752 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jyQpQ-0006E7-PN for qemu-devel@archiver.kernel.org; Wed, 22 Jul 2020 22:19:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54366) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jyQoq-0005mW-Kp for qemu-devel@nongnu.org; Wed, 22 Jul 2020 22:18:48 -0400 Received: from mail-oi1-x232.google.com ([2607:f8b0:4864:20::232]:39522) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jyQoo-0000fa-E5 for qemu-devel@nongnu.org; Wed, 22 Jul 2020 22:18:48 -0400 Received: by mail-oi1-x232.google.com with SMTP id w17so3678068oie.6 for ; Wed, 22 Jul 2020 19:18:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=JVRCT/jvApxzI6mlf1z5VkbHLxRCBfDTSjpNh/APMdY=; b=RjzMqc/vE5UVdwYeG1U1RG/phV5T5gmivMqMbTjqc55ZHqG44jEvEi0TH6XggXo9vx UaiTE+yku3RnWj4z4Zw3OXcNGofekVzvhnkA9aEkKrP+Hco2jcXP4Tr2VO1/3XcrztDc QfhEqX6yK4UGVaijWHhGdTv/yyWsvHSUDiNI3wBK/SjU+g8pfOei8/55C+wApK6FaPyR fKoIkKXppbQL3dfz5iV0dkXrO2szy6Q1IvsD2gANwcmQJrz75WgWbPbsjW07AIXrxdKC 1zCfm8yim2nPNAoPK+ycXcJYdERA5QMdnTIX8buAI+0YBcYj927yVFYB4BBjU10Z38mS Iuxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=JVRCT/jvApxzI6mlf1z5VkbHLxRCBfDTSjpNh/APMdY=; b=d04/ZiNuOrJnng/2QEh5J0arcLorWVQLMF/SsNxPjvx8k0LRcCvM3DuBxJKfDn8Z2T Yob2DTp94pMKjjEnvCu3QKkAjDdQJqaERG31oavYydBYw1PNA2BJbrLaLYLkuXjHw91t DPciSFCYQAWwfJaF/tr0SvSvLU7tFeAgOu851pjDQsrgwD/mRjR/rOeKRXv1oQ15Z3uR qDf/+cmeMVLkp31NUR7ZxLtVPLAeh0R8sHQlXfpvVsqVUwhCDKim41SdPxhCuJqPgy9W tPBIeZwrqEUi2V31U8qCOKpfmmoSafgQpBsI5kQtfoEJQa3ISa7mvc/0k64RbCXRSO28 mS+A== X-Gm-Message-State: AOAM532XuUVNj2vNnIkPxTxwIFrzQFfyDgxqON8ljIAComl5gq6ZPGOw BVYBTWjehHs2rouyYBc8/bTPyo55yl3IaO0LOZRIeg== X-Google-Smtp-Source: ABdhPJxnqmveBrFuu/QT5JK0FKgsceWBqRGGOPoUI5SiPysfOghDhpg/SGyF9UC8UvmzB6PyzZ4XdUvwz1egmnl7nvQ= X-Received: by 2002:aca:b203:: with SMTP id b3mr2051579oif.118.1595470725084; Wed, 22 Jul 2020 19:18:45 -0700 (PDT) MIME-Version: 1.0 References: <20200722091641.8834-1-frank.chang@sifive.com> <20200722091641.8834-17-frank.chang@sifive.com> <05c8267d-f22b-6714-8806-92edf228091e@linaro.org> In-Reply-To: <05c8267d-f22b-6714-8806-92edf228091e@linaro.org> From: Frank Chang Date: Thu, 23 Jul 2020 10:18:34 +0800 Message-ID: Subject: Re: [RFC v2 16/76] target/riscv: rvv-0.9: add VMA and VTA To: Richard Henderson Content-Type: multipart/alternative; boundary="000000000000d181f905ab1279ec" Received-SPF: pass client-ip=2607:f8b0:4864:20::232; envelope-from=frank.chang@sifive.com; helo=mail-oi1-x232.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "open list:RISC-V" , Sagar Karandikar , Bastian Koppelmann , "qemu-devel@nongnu.org Developers" , Palmer Dabbelt , Alistair Francis , LIU Zhiwei Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" --000000000000d181f905ab1279ec Content-Type: text/plain; charset="UTF-8" On Thu, Jul 23, 2020 at 2:00 AM Richard Henderson < richard.henderson@linaro.org> wrote: > On 7/22/20 2:15 AM, frank.chang@sifive.com wrote: > > -static void vext_clear(void *tail, uint32_t cnt, uint32_t tot) > > +static void vext_clear(void *tail, uint32_t vta, uint32_t cnt, uint32_t > tot) > > { > > + if (vta == 0) { > > + /* tail element undisturbed */ > > + return; > > + } > > + > > /* > > + * Tail element agnostic. > > * Split the remaining range to two parts. > > * The first part is in the last uint64_t unit. > > * The second part start from the next uint64_t unit. > > @@ -152,41 +168,50 @@ static void vext_clear(void *tail, uint32_t cnt, > uint32_t tot) > > if (cnt % 8) { > > part1 = 8 - (cnt % 8); > > part2 = tot - cnt - part1; > > - memset((void *)((uintptr_t)tail & ~(7ULL)), 0, part1); > > - memset((void *)(((uintptr_t)tail + 8) & ~(7ULL)), 0, part2); > > + memset((void *)((uintptr_t)tail & ~(7ULL)), 1, part1); > > + memset((void *)(((uintptr_t)tail + 8) & ~(7ULL)), 1, part2); > > } else { > > - memset(tail, 0, part2); > > + memset(tail, 1, part2); > > } > > } > > "1s" surely means all bits set to 1, not each byte to 1. > You're correct, I can't just simply replace the value from 0 to 1. > > Is there any reason to do anything with VTA/VMA at all? One alternative > for > "agnostic" is to leave the values undisturbed. So the quickest thing for > qemu > to do is remove all of this code. Then we don't have to pass the values in > translate either. > > Which is exactly what is recommended in the 4th paragraph of the notes > following the VTA/VMA description. > > I was trying to keep these codes as an option for the user to specify the behaviors of VTA. But as long as it's easier for QEMU to just treat VTA/VMA as agnostic(no changes)/undisturbed. I will remove all the clean functions in my next patchset. > > r~ > Frank Chang --000000000000d181f905ab1279ec Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Thu, Jul 23, 2020 at 2:00 AM Richard H= enderson <richard.hender= son@linaro.org> wrote:
On 7/22/20 2:15 AM, frank.chang@sifive.com wr= ote:
> -static void vext_clear(void *tail, uint32_t cnt, uint32_t tot)
> +static void vext_clear(void *tail, uint32_t vta, uint32_t cnt, uint32= _t tot)
>=C2=A0 {
> +=C2=A0 =C2=A0 if (vta =3D=3D 0) {
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 /* tail element undisturbed */
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 return;
> +=C2=A0 =C2=A0 }
> +
>=C2=A0 =C2=A0 =C2=A0 /*
> +=C2=A0 =C2=A0 =C2=A0* Tail element agnostic.
>=C2=A0 =C2=A0 =C2=A0 =C2=A0* Split the remaining range to two parts. >=C2=A0 =C2=A0 =C2=A0 =C2=A0* The first part is in the last uint64_t uni= t.
>=C2=A0 =C2=A0 =C2=A0 =C2=A0* The second part start from the next uint64= _t unit.
> @@ -152,41 +168,50 @@ static void vext_clear(void *tail, uint32_t cnt,= uint32_t tot)
>=C2=A0 =C2=A0 =C2=A0 if (cnt % 8) {
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 part1 =3D 8 - (cnt % 8);
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 part2 =3D tot - cnt - part1;
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 memset((void *)((uintptr_t)tail & ~(7= ULL)), 0, part1);
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 memset((void *)(((uintptr_t)tail + 8) &am= p; ~(7ULL)), 0, part2);
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 memset((void *)((uintptr_t)tail & ~(7= ULL)), 1, part1);
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 memset((void *)(((uintptr_t)tail + 8) &am= p; ~(7ULL)), 1, part2);
>=C2=A0 =C2=A0 =C2=A0 } else {
> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 memset(tail, 0, part2);
> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 memset(tail, 1, part2);
>=C2=A0 =C2=A0 =C2=A0 }
>=C2=A0 }

"1s" surely means all bits set to 1, not each byte to 1.

You're correct, I can't just simply rep= lace the value from 0 to 1.
=C2=A0

Is there any reason to do anything with VTA/VMA at all?=C2=A0 One alternati= ve for
"agnostic" is to leave the values undisturbed.=C2=A0 So the quick= est thing for qemu
to do is remove all of this code.=C2=A0 Then we don't have to pass the = values in
translate either.

Which is exactly what is recommended in the 4th paragraph of the notes
following the VTA/VMA description.


I was trying to keep these codes as an= option for the user to specify the behaviors of VTA.
But as long= as it's easier for QEMU to just treat VTA/VMA as agnostic(no changes)/= undisturbed.
I will remove all the clean functions in my next pat= chset.=C2=A0
=C2=A0

r~

Frank Chang=C2=A0
--000000000000d181f905ab1279ec--