lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5633995D.20607@huawei.com>
Date:	Fri, 30 Oct 2015 16:22:53 +0000
From:	John Garry <john.garry@...wei.com>
To:	Arnd Bergmann <arnd@...db.de>
CC:	<JBottomley@...n.com>, <robh+dt@...nel.org>, <pawel.moll@....com>,
	<mark.rutland@....com>, <ijc+devicetree@...lion.org.uk>,
	<galak@...eaurora.org>, <linux-scsi@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>, <devicetree@...r.kernel.org>,
	<linuxarm@...wei.com>, <john.garry2@...l.dcu.ie>, <hare@...e.de>,
	<xuwei5@...ilicon.com>, <zhangfei.gao@...aro.org>
Subject: Re: [PATCH v2 27/32] scsi: hisi_sas: add smp protocol support

On 30/10/2015 13:53, Arnd Bergmann wrote:
> On Monday 26 October 2015 22:14:58 John Garry wrote:
>
>> +       /*
>> +       * DMA-map SMP request, response buffers
>> +       */
>> +       /* req */
>> +       sg_req = &task->smp_task.smp_req;
>> +       elem = dma_map_sg(dev, sg_req, 1, DMA_TO_DEVICE);
>> +       if (!elem)
>> +               return -ENOMEM;
>> +       req_len = sg_dma_len(sg_req);
>> +       req_dma_addr = sg_dma_address(sg_req);
>
> If you only use the first element, could you just use dma_map_single()?
>

Can do. Actually sg_req seems only ever has one element:
expander.c, smp_execute_task()
sg_init_one(&task->smp_task.smp_req, req, req_size);

>> +       hdr->cmd_table_addr_lo = cpu_to_le32(lower_32_bits(req_dma_addr));
>> +       hdr->cmd_table_addr_hi = cpu_to_le32(upper_32_bits(req_dma_addr));
>> +
>> +       hdr->sts_buffer_addr_lo =
>> +                       cpu_to_le32(lower_32_bits(slot->status_buffer_dma));
>> +       hdr->sts_buffer_addr_hi =
>> +                       cpu_to_le32(upper_32_bits(slot->status_buffer_dma));
>> +
>>
>
> I see these a lot in your code. Could you replace this wit
>
> 	hdr->cmd_table_addr = cpu_to_le64(req_dma_addr);
>
This seems reasonable. They are not swapped.

> and so on? That would be much more readable. Or are the two __le32 variables
> swapped? If so, you could add a small helper function like
>
> static inline __le64 cpu_to_le64_wordswapped(u64 val)
> {
> 	return cpu_to_le64(val >> 32 | val << 32);
> }
>
> 	Arnd
>
> .
>

cheers


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ