KVM ARM Archive on lore.kernel.org
 help / color / Atom feed
From: Auger Eric <eric.auger@redhat.com>
To: Zenghui Yu <yuzenghui@huawei.com>
Cc: kvm@vger.kernel.org, maz@kernel.org, qemu-devel@nongnu.org,
	qemu-arm@nongnu.org, andre.przywara@arm.com, thuth@redhat.com,
	kvmarm@lists.cs.columbia.edu, eric.auger.pro@gmail.com
Subject: Re: [kvm-unit-tests PATCH v7 09/13] arm/arm64: ITS: Commands
Date: Mon, 30 Mar 2020 11:57:55 +0200
Message-ID: <885f656f-08a4-7e7b-f2b8-0e3921a58bb9@redhat.com> (raw)
In-Reply-To: <84493416-7b0d-df3e-df56-cedcbdd72010@huawei.com>

Hi Zenghui,

On 3/30/20 11:22 AM, Zenghui Yu wrote:
> Hi Eric,
> 
> On 2020/3/20 17:24, Eric Auger wrote:
>> Implement main ITS commands. The code is largely inherited from
>> the ITS driver.
>>
>> Signed-off-by: Eric Auger <eric.auger@redhat.com>
> 
> [...]
> 
>> +/* ITS COMMANDS */
>> +
>> +static void its_encode_cmd(struct its_cmd_block *cmd, u8 cmd_nr)
>> +{
>> +    cmd->raw_cmd[0] &= ~0xffUL;
>> +    cmd->raw_cmd[0] |= cmd_nr;
>> +}
>> +
>> +static void its_encode_devid(struct its_cmd_block *cmd, u32 devid)
>> +{
>> +    cmd->raw_cmd[0] &= BIT_ULL(32) - 1;
>> +    cmd->raw_cmd[0] |= ((u64)devid) << 32;
>> +}
>> +
>> +static void its_encode_event_id(struct its_cmd_block *cmd, u32 id)
>> +{
>> +    cmd->raw_cmd[1] &= ~0xffffffffUL;
>> +    cmd->raw_cmd[1] |= id;
>> +}
>> +
>> +static void its_encode_phys_id(struct its_cmd_block *cmd, u32 phys_id)
>> +{
>> +    cmd->raw_cmd[1] &= 0xffffffffUL;
>> +    cmd->raw_cmd[1] |= ((u64)phys_id) << 32;
>> +}
>> +
>> +static void its_encode_size(struct its_cmd_block *cmd, u8 size)
>> +{
>> +    cmd->raw_cmd[1] &= ~0x1fUL;
>> +    cmd->raw_cmd[1] |= size & 0x1f;
>> +}
>> +
>> +static void its_encode_itt(struct its_cmd_block *cmd, u64 itt_addr)
>> +{
>> +    cmd->raw_cmd[2] &= ~0xffffffffffffUL;
>> +    cmd->raw_cmd[2] |= itt_addr & 0xffffffffff00UL;
>> +}
>> +
>> +static void its_encode_valid(struct its_cmd_block *cmd, int valid)
>> +{
>> +    cmd->raw_cmd[2] &= ~(1UL << 63);
>> +    cmd->raw_cmd[2] |= ((u64)!!valid) << 63;
>> +}
>> +
>> +static void its_encode_target(struct its_cmd_block *cmd, u64
>> target_addr)
>> +{
>> +    cmd->raw_cmd[2] &= ~(0xfffffffffUL << 16);
>> +    cmd->raw_cmd[2] |= (target_addr & (0xffffffffUL << 16));
>> +}
>> +
>> +static void its_encode_collection(struct its_cmd_block *cmd, u16 col)
>> +{
>> +    cmd->raw_cmd[2] &= ~0xffffUL;
>> +    cmd->raw_cmd[2] |= col;
>> +}
> 
> The command encoding can be refactored like:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4d36f136d57aea6f6440886106e246bb7e5918d8
> 
> 
> which will look much clearer.
OK
> 
> [...]
> 
>> +static void its_send_single_command(its_cmd_builder_t builder,
>> +                    struct its_cmd_desc *desc)
>> +{
>> +    struct its_cmd_block *cmd, *next_cmd;
>> +
>> +    cmd = its_allocate_entry();
>> +    builder(cmd, desc);
>> +    next_cmd = its_post_commands();
>> +
>> +    its_wait_for_range_completion(cmd, next_cmd);
>> +}
>> +
>> +
> 
> extra line.
OK
> 
>> +static void its_build_mapd_cmd(struct its_cmd_block *cmd,
>> +                   struct its_cmd_desc *desc)
>> +{
>> +    unsigned long itt_addr;
>> +    u8 size = 12; /* 4096 eventids */
> 
> Maybe use desc->its_mapd_cmd.dev->nr_ites instead as we already have it?
OK
> 
>> +
>> +    itt_addr = (unsigned
>> long)(virt_to_phys(desc->its_mapd_cmd.dev->itt));
>> +    itt_addr = ALIGN(itt_addr, ITS_ITT_ALIGN);
>> +
>> +    its_encode_cmd(cmd, GITS_CMD_MAPD);
>> +    its_encode_devid(cmd, desc->its_mapd_cmd.dev->device_id);
>> +    its_encode_size(cmd, size - 1);
>> +    its_encode_itt(cmd, itt_addr);
>> +    its_encode_valid(cmd, desc->its_mapd_cmd.valid);
>> +    its_fixup_cmd(cmd);
>> +    if (desc->verbose)
>> +        printf("ITS: MAPD devid=%d size = 0x%x itt=0x%lx valid=%d\n",
>> +            desc->its_mapd_cmd.dev->device_id,
>> +            size, itt_addr, desc->its_mapd_cmd.valid);
>> +
> 
> extra line.
> 
> All of these are trivial things and feel free to ignore them,
> Reviewed-by: Zenghui Yu <yuzenghui@huawei.com>
thanks!

Eric
> 
> 
> Thanks
> 

_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

  reply index

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-20  9:24 [kvm-unit-tests PATCH v7 00/13] arm/arm64: Add ITS tests Eric Auger
2020-03-20  9:24 ` [kvm-unit-tests PATCH v7 01/13] libcflat: Add other size defines Eric Auger
2020-03-20  9:24 ` [kvm-unit-tests PATCH v7 02/13] page_alloc: Introduce get_order() Eric Auger
2020-03-20  9:24 ` [kvm-unit-tests PATCH v7 03/13] arm/arm64: gic: Introduce setup_irq() helper Eric Auger
2020-03-20  9:24 ` [kvm-unit-tests PATCH v7 04/13] arm/arm64: gicv3: Add some re-distributor defines Eric Auger
2020-03-20  9:24 ` [kvm-unit-tests PATCH v7 05/13] arm/arm64: gicv3: Set the LPI config and pending tables Eric Auger
2020-03-20  9:24 ` [kvm-unit-tests PATCH v7 06/13] arm/arm64: ITS: Introspection tests Eric Auger
2020-03-30  8:30   ` Zenghui Yu
2020-03-30  8:46     ` Auger Eric
2020-03-30  9:11       ` Andrew Jones
2020-03-30  9:56         ` Auger Eric
2020-03-30 10:19           ` Andrew Jones
2020-03-30 10:24             ` Auger Eric
2020-03-30 12:20         ` Zenghui Yu
2020-03-20  9:24 ` [kvm-unit-tests PATCH v7 07/13] arm/arm64: ITS: its_enable_defaults Eric Auger
2020-03-20  9:24 ` [kvm-unit-tests PATCH v7 08/13] arm/arm64: ITS: Device and collection Initialization Eric Auger
2020-03-25  8:10   ` Zenghui Yu
2020-03-25 21:20     ` Auger Eric
2020-03-30  9:13       ` Andrew Jones
2020-03-20  9:24 ` [kvm-unit-tests PATCH v7 09/13] arm/arm64: ITS: Commands Eric Auger
2020-03-30  9:22   ` Zenghui Yu
2020-03-30  9:57     ` Auger Eric [this message]
2020-03-20  9:24 ` [kvm-unit-tests PATCH v7 10/13] arm/arm64: ITS: INT functional tests Eric Auger
2020-03-30 10:43   ` Zenghui Yu
2020-04-02  8:50     ` Auger Eric
2020-04-02 12:40       ` Zenghui Yu
2020-04-02 14:41         ` Andrew Jones
2020-03-20  9:24 ` [kvm-unit-tests PATCH v7 11/13] arm/run: Allow Migration tests Eric Auger
2020-03-20  9:24 ` [kvm-unit-tests PATCH v7 12/13] arm/arm64: ITS: migration tests Eric Auger
2020-03-30 10:55   ` Zenghui Yu
2020-03-20  9:24 ` [kvm-unit-tests PATCH v7 13/13] arm/arm64: ITS: pending table migration test Eric Auger
2020-03-30 12:06   ` Zenghui Yu
2020-03-30 12:38     ` Auger Eric
2020-03-30 13:17       ` Zenghui Yu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=885f656f-08a4-7e7b-f2b8-0e3921a58bb9@redhat.com \
    --to=eric.auger@redhat.com \
    --cc=andre.przywara@arm.com \
    --cc=eric.auger.pro@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=maz@kernel.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=thuth@redhat.com \
    --cc=yuzenghui@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

KVM ARM Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/kvmarm/0 kvmarm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 kvmarm kvmarm/ https://lore.kernel.org/kvmarm \
		kvmarm@lists.cs.columbia.edu
	public-inbox-index kvmarm

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/edu.columbia.cs.lists.kvmarm


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git