* Addresses in PxCLB and PxCLBU
@ 2015-07-06 23:41 Andy Falanga (afalanga)
2015-07-08 10:44 ` Sergei Shtylyov
0 siblings, 1 reply; 3+ messages in thread
From: Andy Falanga (afalanga) @ 2015-07-06 23:41 UTC (permalink / raw)
To: linux-ide@vger.kernel.org
Hi,
I'm working with the registers in an AHCI controller. The memory
address contained in PxCLB and PxCLBU (if 64-bit addressing is
supported): what kind of address are they? Currently, when I get the
address and place it into a pointer of struct ahci_cmd_hdr and try to
dereference, my VM locks and then reboots. What am I doing incorrectly?
Basically, I have this:
void __iomem * pbase = ahci_port_base((struct ata_port*));
struct ahci_cmd_hdr *cmd_hdr = NULL;
cmd_hdr = (struct ahci_cmd_hdr*)(u64)
((u64)(*(temp + PORT_LST_ADDR_HI)) << 32 | *temp);
pr_info("cmd_hdr is %p\n", cmd_hdr);
pr_info("cmd_hdr->opts is %d\n", cmd_hdr->opts); /* opts is __le32 */
At the last line above my VM hangs and reboots. The memory address is
something like 0x0000000037900000. This address makes me think that I
simply can't dereference it but I'm quite new to this and I don't know
what I should do. I'd appreciate any help even if that's a pointer (no
pun intended) to a more appropriate forum.
Thanks,
Andy
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: Addresses in PxCLB and PxCLBU
2015-07-06 23:41 Addresses in PxCLB and PxCLBU Andy Falanga (afalanga)
@ 2015-07-08 10:44 ` Sergei Shtylyov
2015-07-08 14:20 ` Andy Falanga (afalanga)
0 siblings, 1 reply; 3+ messages in thread
From: Sergei Shtylyov @ 2015-07-08 10:44 UTC (permalink / raw)
To: Andy Falanga (afalanga), linux-ide@vger.kernel.org
Hello.
On 7/7/2015 2:41 AM, Andy Falanga (afalanga) wrote:
> I'm working with the registers in an AHCI controller. The memory
> address contained in PxCLB and PxCLBU (if 64-bit addressing is
> supported): what kind of address are they?
Apparently, physical. The hardware only operates on the physical addresses.
> Currently, when I get the
> address and place it into a pointer of struct ahci_cmd_hdr and try to
> dereference, my VM locks and then reboots. What am I doing incorrectly?
You can't de-reference physical addresses.
> Basically, I have this:
> void __iomem * pbase = ahci_port_base((struct ata_port*));
Can't parse this.
> struct ahci_cmd_hdr *cmd_hdr = NULL;
> cmd_hdr = (struct ahci_cmd_hdr*)(u64)
> ((u64)(*(temp + PORT_LST_ADDR_HI)) << 32 | *temp);
temp?
> pr_info("cmd_hdr is %p\n", cmd_hdr);
> pr_info("cmd_hdr->opts is %d\n", cmd_hdr->opts); /* opts is __le32 */
> At the last line above my VM hangs and reboots. The memory address is
> something like 0x0000000037900000. This address makes me think that I
> simply can't dereference it but I'm quite new to this and I don't know
> what I should do. I'd appreciate any help even if that's a pointer (no
> pun intended) to a more appropriate forum.
The corresponding virtual address seems to be contained in
ahci_port_priv::cmd_slot.
> Thanks,
> Andy
WBR, Sergei
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: Addresses in PxCLB and PxCLBU
2015-07-08 10:44 ` Sergei Shtylyov
@ 2015-07-08 14:20 ` Andy Falanga (afalanga)
0 siblings, 0 replies; 3+ messages in thread
From: Andy Falanga (afalanga) @ 2015-07-08 14:20 UTC (permalink / raw)
To: Sergei Shtylyov, linux-ide@vger.kernel.org
On 07/08/2015 04:44 AM, Sergei Shtylyov wrote:
> Hello.
>
> On 7/7/2015 2:41 AM, Andy Falanga (afalanga) wrote:
>
>> I'm working with the registers in an AHCI controller. The memory
>> address contained in PxCLB and PxCLBU (if 64-bit addressing is
>> supported): what kind of address are they?
>
> Apparently, physical. The hardware only operates on the physical
> addresses.
>
>> Currently, when I get the
>> address and place it into a pointer of struct ahci_cmd_hdr and try to
>> dereference, my VM locks and then reboots. What am I doing incorrectly?
>
> You can't de-reference physical addresses.
>
>> Basically, I have this:
>
>> void __iomem * pbase = ahci_port_base((struct ata_port*));
>
> Can't parse this.
>
>> struct ahci_cmd_hdr *cmd_hdr = NULL;
>
>> cmd_hdr = (struct ahci_cmd_hdr*)(u64)
>> ((u64)(*(temp + PORT_LST_ADDR_HI)) << 32 | *temp);
>
> temp?
>
>> pr_info("cmd_hdr is %p\n", cmd_hdr);
>> pr_info("cmd_hdr->opts is %d\n", cmd_hdr->opts); /* opts is __le32 */
>
>> At the last line above my VM hangs and reboots. The memory address is
>> something like 0x0000000037900000. This address makes me think that I
>> simply can't dereference it but I'm quite new to this and I don't know
>> what I should do. I'd appreciate any help even if that's a pointer (no
>> pun intended) to a more appropriate forum.
>
> The corresponding virtual address seems to be contained in
> ahci_port_priv::cmd_slot.
>
>> Thanks,
>> Andy
>
Thank you Sergei. You are correct. I'm finding that ditching old
habits from user-land are hard to do. I knew I needed to use things
like ioread*/iowrite* when accessing those pointers but I just got stuck
in a rhythm of "I've got a pointer now all I do is dereference ...." .
Oh well.
Thanks much for getting back to me.
Andy
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-07-08 14:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-06 23:41 Addresses in PxCLB and PxCLBU Andy Falanga (afalanga)
2015-07-08 10:44 ` Sergei Shtylyov
2015-07-08 14:20 ` Andy Falanga (afalanga)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).