Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

<Overfiend> penis jokes are okay in mixed company. VMS is NOT!!!


computers / comp.os.vms / Device Driver Kernel-User Buffer Mapping

SubjectAuthor
* Device Driver Kernel-User Buffer MappingLuigi Thirty
`* Re: Device Driver Kernel-User Buffer MappingRoger Ivie
 `* Re: Device Driver Kernel-User Buffer MappingLuigi Thirty
  `* Re: Device Driver Kernel-User Buffer MappingLuigi Thirty
   `* Re: Device Driver Kernel-User Buffer MappingRoger Ivie
    `* Re: Device Driver Kernel-User Buffer MappingLuigi Thirty
     `* Re: Device Driver Kernel-User Buffer MappingDavid Jones
      `* Re: Device Driver Kernel-User Buffer MappingRoger Ivie
       `- Re: Device Driver Kernel-User Buffer MappingLuigi Thirty

1
Device Driver Kernel-User Buffer Mapping

<11c989a1-fe8f-42c5-8521-eb0682c828c0n@googlegroups.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=14726&group=comp.os.vms#14726

  copy link   Newsgroups: comp.os.vms
X-Received: by 2002:ac8:7fc5:: with SMTP id b5mr17085816qtk.122.1620549667322; Sun, 09 May 2021 01:41:07 -0700 (PDT)
X-Received: by 2002:ae9:d887:: with SMTP id u129mr7589643qkf.394.1620549667165; Sun, 09 May 2021 01:41:07 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!2.eu.feeder.erje.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed9.news.xs4all.nl!tr3.eu1.usenetexpress.com!feeder.usenetexpress.com!tr2.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.os.vms
Date: Sun, 9 May 2021 01:41:06 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=24.12.66.179; posting-account=jZu0MQoAAAAjASNAm1sGOFyq6JgsLQLi
NNTP-Posting-Host: 24.12.66.179
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <11c989a1-fe8f-42c5-8521-eb0682c828c0n@googlegroups.com>
Subject: Device Driver Kernel-User Buffer Mapping
From: luig...@gmail.com (Luigi Thirty)
Injection-Date: Sun, 09 May 2021 08:41:07 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 19
 by: Luigi Thirty - Sun, 9 May 2021 08:41 UTC

Hi,

I’m a hobbyist with an AlphaServer DS10 running 8.4. I have a certain PCI card that I’m writing a driver for as a project.

The card uses 16MB of linear address space in the PCI segment and no I/O space. I’ve used IOC$MAP_IO to map it into virtual memory and can access the card’s memory space from the kernel context no problem. I have read and write QIO commands hooked up as well which a user process can call.

What I would like to do, though, is make the PCI memory buffer directly accessible from a user process that’s opened a channel to the device and made a request for it. In Linux this would be mmap() with a shared buffer, in NT this would be IOCTL_MAPMEM_USER_PHYSICAL_MEMORY but I can’t find the equivalent in the VMS documentation.

Any ideas?

Katherine

Re: Device Driver Kernel-User Buffer Mapping

<792ea91d-07b8-4a63-a77f-95327a5cce5dn@googlegroups.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=14727&group=comp.os.vms#14727

  copy link   Newsgroups: comp.os.vms
X-Received: by 2002:a37:ac0f:: with SMTP id e15mr8715620qkm.6.1620573859002;
Sun, 09 May 2021 08:24:19 -0700 (PDT)
X-Received: by 2002:a05:6214:a8b:: with SMTP id ev11mr19748278qvb.42.1620573858879;
Sun, 09 May 2021 08:24:18 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.os.vms
Date: Sun, 9 May 2021 08:24:18 -0700 (PDT)
In-Reply-To: <11c989a1-fe8f-42c5-8521-eb0682c828c0n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=173.19.193.52; posting-account=zvIpTQoAAABQJtJR1phhrQImju0wTmq2
NNTP-Posting-Host: 173.19.193.52
References: <11c989a1-fe8f-42c5-8521-eb0682c828c0n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <792ea91d-07b8-4a63-a77f-95327a5cce5dn@googlegroups.com>
Subject: Re: Device Driver Kernel-User Buffer Mapping
From: roger.i...@gmail.com (Roger Ivie)
Injection-Date: Sun, 09 May 2021 15:24:18 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Roger Ivie - Sun, 9 May 2021 15:24 UTC

On Sunday, May 9, 2021 at 1:41:08 AM UTC-7, lui...@gmail.com wrote:

> What I would like to do, though, is make the PCI memory buffer directly
> accessible from a user process that’s opened a channel to the device
> and made a request for it. In Linux this would be mmap() with a shared
> buffer, in NT this would be IOCTL_MAPMEM_USER_PHYSICAL_MEMORY
> but I can’t find the equivalent in the VMS documentation.

the term you're looking for is pfn-mapping. in this situation, i've arranged an io$_sensemode function that returns the information the user process needs to create a pfn mapping that covers the section. there are, however, many landmines in this area.

we have several custom devices in our labs and i am responsible for the device drivers for those devices. many years ago, i got tired of maintaining several device drivers that were very similar, so i created a generic pci device driver that can handle pretty much any device. it provides the information a user process needs to create a pfn-mapped section that covers the register, collects interrupts for deliver to the user program, and can pin buffers down and describe their mapping so that a user program can configure the device to access the buffer.

it's been a while since i've had to go into the driver and i don't have access to the documentation (and no idea where hp has moved them this week) and driver sources, so my memory is a bit fuzzy around the details.

back in the day, global sections and pfn-mapped sections were accessed using the same system services, $crmpsc and $mgblsc. there are sections that will be either pfn-mapped or mapped as a global section, depending on the details of the lab configuration. my strategy to deal with this was to try one type of mapping and, if that failed, retry it as the other type. eventually, the global section and pfn-mapped section services were split into independent system services. at that point, there was one combination (i.e., either trying to map a pfn-mapped section as a global section or trying to map a global section as a pfn-mapped section) that would cause the system to crash. naturally, my mapping routine was making the attempts in the order that caused the system to crash.

interrupts are handled by placing the irp on a queue, then enabling interrupts from the device. when an interrupt happens, the driver disables interrupts from the device, then completes all of the irps sitting on the queue. some versions of alpha/vms do not properly handle disabling interrupts from a device; it's as if the bus support author never entertained the possibility that someone might want to disable interrupts. in addition to doing the actual work involved in disabling interrupts, the bus support code maintains a bitmap tracking which interrupts are disabled. when an interrupt is enabled, the bus support code does the work and sets a bit in the map to note that it has enabled the interrupt. however, when an interrupt is disabled, the bus support code does the work but *does not* clear the bit in the map. consequently, the next time you enable an interrupt, the bus support code does nothing because it thinks the interrupt is already enabled. the device driver works around this on those situations by clearing the bit in the bus support code's bitmap when it disables an interrupt.

the most recent issue i had with the driver involved shared interrupts. if you attach a driver that does not handle shared interrupts to a device that is connected to a shared interrupt line, the operating system refuses to initialize the driver; it does not call *any* of the driver's initialization functions. however, there are still situations in which the operating system calls the driver's $cancel entry point, even though the driver has not been initialized. i didn't expect this, and my driver would crash when the $cancel entry was called without any of the driver's data structures having been initialized.

good luck!
--
roger ivie
roger.ivie@gmail.com

Re: Device Driver Kernel-User Buffer Mapping

<1d371858-3a8e-4f4d-9eff-d0db3e9cb147n@googlegroups.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=14728&group=comp.os.vms#14728

  copy link   Newsgroups: comp.os.vms
X-Received: by 2002:ac8:7285:: with SMTP id v5mr20390134qto.247.1620609689030; Sun, 09 May 2021 18:21:29 -0700 (PDT)
X-Received: by 2002:a0c:e30c:: with SMTP id s12mr21588730qvl.47.1620609688833; Sun, 09 May 2021 18:21:28 -0700 (PDT)
Path: i2pn2.org!i2pn.org!paganini.bofh.team!news.dns-netz.com!news.freedyn.net!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!tr2.eu1.usenetexpress.com!feeder.usenetexpress.com!tr3.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.os.vms
Date: Sun, 9 May 2021 18:21:28 -0700 (PDT)
In-Reply-To: <792ea91d-07b8-4a63-a77f-95327a5cce5dn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=24.12.66.179; posting-account=jZu0MQoAAAAjASNAm1sGOFyq6JgsLQLi
NNTP-Posting-Host: 24.12.66.179
References: <11c989a1-fe8f-42c5-8521-eb0682c828c0n@googlegroups.com> <792ea91d-07b8-4a63-a77f-95327a5cce5dn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <1d371858-3a8e-4f4d-9eff-d0db3e9cb147n@googlegroups.com>
Subject: Re: Device Driver Kernel-User Buffer Mapping
From: luig...@gmail.com (Luigi Thirty)
Injection-Date: Mon, 10 May 2021 01:21:29 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 80
 by: Luigi Thirty - Mon, 10 May 2021 01:21 UTC

Okay, cool, so I need to find the PFN corresponding to the buffer and set up a mapping so that the process holding the channel can access that region. I'll need to figure out the full 64-bit PCI address space mapping for the DS10 then, since my documentation is conspicuously missing that and I can't seem to find the physical address with SHOW ADDR/PHY in SDA.

Fortunately it's a pretty simple PCI card from the host system's perspective - there's no interrupts or I/O space required, it's all memory-mapped I/O..

On Sunday, May 9, 2021 at 10:24:20 AM UTC-5, Roger Ivie wrote:
> On Sunday, May 9, 2021 at 1:41:08 AM UTC-7, lui...@gmail.com wrote:
>
> > What I would like to do, though, is make the PCI memory buffer directly
> > accessible from a user process that’s opened a channel to the device
> > and made a request for it. In Linux this would be mmap() with a shared
> > buffer, in NT this would be IOCTL_MAPMEM_USER_PHYSICAL_MEMORY
> > but I can’t find the equivalent in the VMS documentation.
> the term you're looking for is pfn-mapping. in this situation, i've arranged an io$_sensemode function that returns the information the user process needs to create a pfn mapping that covers the section. there are, however, many landmines in this area.
>
> we have several custom devices in our labs and i am responsible for the device drivers for those devices. many years ago, i got tired of maintaining several device drivers that were very similar, so i created a generic pci device driver that can handle pretty much any device. it provides the information a user process needs to create a pfn-mapped section that covers the register, collects interrupts for deliver to the user program, and can pin buffers down and describe their mapping so that a user program can configure the device to access the buffer.
>
> it's been a while since i've had to go into the driver and i don't have access to the documentation (and no idea where hp has moved them this week) and driver sources, so my memory is a bit fuzzy around the details.
>
> back in the day, global sections and pfn-mapped sections were accessed using the same system services, $crmpsc and $mgblsc. there are sections that will be either pfn-mapped or mapped as a global section, depending on the details of the lab configuration. my strategy to deal with this was to try one type of mapping and, if that failed, retry it as the other type. eventually, the global section and pfn-mapped section services were split into independent system services. at that point, there was one combination (i.e., either trying to map a pfn-mapped section as a global section or trying to map a global section as a pfn-mapped section) that would cause the system to crash. naturally, my mapping routine was making the attempts in the order that caused the system to crash.
>
> interrupts are handled by placing the irp on a queue, then enabling interrupts from the device. when an interrupt happens, the driver disables interrupts from the device, then completes all of the irps sitting on the queue. some versions of alpha/vms do not properly handle disabling interrupts from a device; it's as if the bus support author never entertained the possibility that someone might want to disable interrupts. in addition to doing the actual work involved in disabling interrupts, the bus support code maintains a bitmap tracking which interrupts are disabled. when an interrupt is enabled, the bus support code does the work and sets a bit in the map to note that it has enabled the interrupt. however, when an interrupt is disabled, the bus support code does the work but *does not* clear the bit in the map. consequently, the next time you enable an interrupt, the bus support code does nothing because it thinks the interrupt is already enabled. the device driver works around this on those situations by clearing the bit in the bus support code's bitmap when it disables an interrupt.
>
> the most recent issue i had with the driver involved shared interrupts. if you attach a driver that does not handle shared interrupts to a device that is connected to a shared interrupt line, the operating system refuses to initialize the driver; it does not call *any* of the driver's initialization functions. however, there are still situations in which the operating system calls the driver's $cancel entry point, even though the driver has not been initialized. i didn't expect this, and my driver would crash when the $cancel entry was called without any of the driver's data structures having been initialized.
>
> good luck!
> --
> roger ivie
> roger...@gmail.com

Re: Device Driver Kernel-User Buffer Mapping

<3f17f0a0-8e52-4ab2-95d3-c5e22c75e547n@googlegroups.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=14729&group=comp.os.vms#14729

  copy link   Newsgroups: comp.os.vms
X-Received: by 2002:ac8:615c:: with SMTP id d28mr11378356qtm.192.1620611071048; Sun, 09 May 2021 18:44:31 -0700 (PDT)
X-Received: by 2002:a37:8b45:: with SMTP id n66mr5478562qkd.382.1620611070872; Sun, 09 May 2021 18:44:30 -0700 (PDT)
Path: i2pn2.org!i2pn.org!aioe.org!feeder1.feed.usenet.farm!feed.usenet.farm!tr2.eu1.usenetexpress.com!feeder.usenetexpress.com!tr3.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.os.vms
Date: Sun, 9 May 2021 18:44:30 -0700 (PDT)
In-Reply-To: <1d371858-3a8e-4f4d-9eff-d0db3e9cb147n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=24.12.66.179; posting-account=jZu0MQoAAAAjASNAm1sGOFyq6JgsLQLi
NNTP-Posting-Host: 24.12.66.179
References: <11c989a1-fe8f-42c5-8521-eb0682c828c0n@googlegroups.com> <792ea91d-07b8-4a63-a77f-95327a5cce5dn@googlegroups.com> <1d371858-3a8e-4f4d-9eff-d0db3e9cb147n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <3f17f0a0-8e52-4ab2-95d3-c5e22c75e547n@googlegroups.com>
Subject: Re: Device Driver Kernel-User Buffer Mapping
From: luig...@gmail.com (Luigi Thirty)
Injection-Date: Mon, 10 May 2021 01:44:31 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 85
 by: Luigi Thirty - Mon, 10 May 2021 01:44 UTC

Specifically, the problem is that IOC$MAP_IO returns a handle value which I can't figure out how to resolve to a virtual address, so I don't know where in system memory my PCI device is mapped. Unless the "magic number" it returns happens to be a pointer to an IOHANDLE or something.

On Sunday, May 9, 2021 at 8:21:30 PM UTC-5, Luigi Thirty wrote:
> Okay, cool, so I need to find the PFN corresponding to the buffer and set up a mapping so that the process holding the channel can access that region. I'll need to figure out the full 64-bit PCI address space mapping for the DS10 then, since my documentation is conspicuously missing that and I can't seem to find the physical address with SHOW ADDR/PHY in SDA.
>
> Fortunately it's a pretty simple PCI card from the host system's perspective - there's no interrupts or I/O space required, it's all memory-mapped I/O.
> On Sunday, May 9, 2021 at 10:24:20 AM UTC-5, Roger Ivie wrote:
> > On Sunday, May 9, 2021 at 1:41:08 AM UTC-7, lui...@gmail.com wrote:
> >
> > > What I would like to do, though, is make the PCI memory buffer directly
> > > accessible from a user process that’s opened a channel to the device
> > > and made a request for it. In Linux this would be mmap() with a shared
> > > buffer, in NT this would be IOCTL_MAPMEM_USER_PHYSICAL_MEMORY
> > > but I can’t find the equivalent in the VMS documentation.
> > the term you're looking for is pfn-mapping. in this situation, i've arranged an io$_sensemode function that returns the information the user process needs to create a pfn mapping that covers the section. there are, however, many landmines in this area.
> >
> > we have several custom devices in our labs and i am responsible for the device drivers for those devices. many years ago, i got tired of maintaining several device drivers that were very similar, so i created a generic pci device driver that can handle pretty much any device. it provides the information a user process needs to create a pfn-mapped section that covers the register, collects interrupts for deliver to the user program, and can pin buffers down and describe their mapping so that a user program can configure the device to access the buffer.
> >
> > it's been a while since i've had to go into the driver and i don't have access to the documentation (and no idea where hp has moved them this week) and driver sources, so my memory is a bit fuzzy around the details.
> >
> > back in the day, global sections and pfn-mapped sections were accessed using the same system services, $crmpsc and $mgblsc. there are sections that will be either pfn-mapped or mapped as a global section, depending on the details of the lab configuration. my strategy to deal with this was to try one type of mapping and, if that failed, retry it as the other type. eventually, the global section and pfn-mapped section services were split into independent system services. at that point, there was one combination (i.e., either trying to map a pfn-mapped section as a global section or trying to map a global section as a pfn-mapped section) that would cause the system to crash. naturally, my mapping routine was making the attempts in the order that caused the system to crash.
> >
> > interrupts are handled by placing the irp on a queue, then enabling interrupts from the device. when an interrupt happens, the driver disables interrupts from the device, then completes all of the irps sitting on the queue. some versions of alpha/vms do not properly handle disabling interrupts from a device; it's as if the bus support author never entertained the possibility that someone might want to disable interrupts. in addition to doing the actual work involved in disabling interrupts, the bus support code maintains a bitmap tracking which interrupts are disabled. when an interrupt is enabled, the bus support code does the work and sets a bit in the map to note that it has enabled the interrupt. however, when an interrupt is disabled, the bus support code does the work but *does not* clear the bit in the map. consequently, the next time you enable an interrupt, the bus support code does nothing because it thinks the interrupt is already enabled. the device driver works around this on those situations by clearing the bit in the bus support code's bitmap when it disables an interrupt.
> >
> > the most recent issue i had with the driver involved shared interrupts. if you attach a driver that does not handle shared interrupts to a device that is connected to a shared interrupt line, the operating system refuses to initialize the driver; it does not call *any* of the driver's initialization functions. however, there are still situations in which the operating system calls the driver's $cancel entry point, even though the driver has not been initialized. i didn't expect this, and my driver would crash when the $cancel entry was called without any of the driver's data structures having been initialized.
> >
> > good luck!
> > --
> > roger ivie
> > roger...@gmail.com

Re: Device Driver Kernel-User Buffer Mapping

<b79bb79e-927a-4009-9167-3ff9d5123074n@googlegroups.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=14741&group=comp.os.vms#14741

  copy link   Newsgroups: comp.os.vms
X-Received: by 2002:ac8:5946:: with SMTP id 6mr28074038qtz.366.1620738051723;
Tue, 11 May 2021 06:00:51 -0700 (PDT)
X-Received: by 2002:a37:815:: with SMTP id 21mr27106297qki.498.1620738051492;
Tue, 11 May 2021 06:00:51 -0700 (PDT)
Path: i2pn2.org!i2pn.org!aioe.org!news.uzoreto.com!newsfeed.xs4all.nl!newsfeed9.news.xs4all.nl!news-out.netnews.com!news.alt.net!fdc3.netnews.com!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.os.vms
Date: Tue, 11 May 2021 06:00:51 -0700 (PDT)
In-Reply-To: <3f17f0a0-8e52-4ab2-95d3-c5e22c75e547n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=173.19.193.52; posting-account=zvIpTQoAAABQJtJR1phhrQImju0wTmq2
NNTP-Posting-Host: 173.19.193.52
References: <11c989a1-fe8f-42c5-8521-eb0682c828c0n@googlegroups.com>
<792ea91d-07b8-4a63-a77f-95327a5cce5dn@googlegroups.com> <1d371858-3a8e-4f4d-9eff-d0db3e9cb147n@googlegroups.com>
<3f17f0a0-8e52-4ab2-95d3-c5e22c75e547n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <b79bb79e-927a-4009-9167-3ff9d5123074n@googlegroups.com>
Subject: Re: Device Driver Kernel-User Buffer Mapping
From: roger.i...@gmail.com (Roger Ivie)
Injection-Date: Tue, 11 May 2021 13:00:51 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1971
 by: Roger Ivie - Tue, 11 May 2021 13:00 UTC

On Sunday, May 9, 2021 at 6:44:32 PM UTC-7, lui...@gmail.com wrote:
> Specifically, the problem is that IOC$MAP_IO returns a handle value which I can't figure
> out how to resolve to a virtual address, so I don't know where in system memory my PCI
> device is mapped. Unless the "magic number" it returns happens to be a pointer to an
> IOHANDLE or something.

the iohandle holds the *physical* address at which your device is mapped. you use that to create the page frame number you need to hand to the appropriate flavor of $crmpsc to create a pfn-mapped section. $crmpsc gives you the virtual address.
--
roger ivie
roger.ivie@gmail.com

Re: Device Driver Kernel-User Buffer Mapping

<8cdbb5fb-15d8-40fc-8113-d3fdf4996684n@googlegroups.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=14762&group=comp.os.vms#14762

  copy link   Newsgroups: comp.os.vms
X-Received: by 2002:a05:620a:5fc:: with SMTP id z28mr33660416qkg.378.1620833191142;
Wed, 12 May 2021 08:26:31 -0700 (PDT)
X-Received: by 2002:a05:620a:5e2:: with SMTP id z2mr19295147qkg.132.1620833190965;
Wed, 12 May 2021 08:26:30 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.os.vms
Date: Wed, 12 May 2021 08:26:30 -0700 (PDT)
In-Reply-To: <b79bb79e-927a-4009-9167-3ff9d5123074n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=24.12.66.179; posting-account=jZu0MQoAAAAjASNAm1sGOFyq6JgsLQLi
NNTP-Posting-Host: 24.12.66.179
References: <11c989a1-fe8f-42c5-8521-eb0682c828c0n@googlegroups.com>
<792ea91d-07b8-4a63-a77f-95327a5cce5dn@googlegroups.com> <1d371858-3a8e-4f4d-9eff-d0db3e9cb147n@googlegroups.com>
<3f17f0a0-8e52-4ab2-95d3-c5e22c75e547n@googlegroups.com> <b79bb79e-927a-4009-9167-3ff9d5123074n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <8cdbb5fb-15d8-40fc-8113-d3fdf4996684n@googlegroups.com>
Subject: Re: Device Driver Kernel-User Buffer Mapping
From: luig...@gmail.com (Luigi Thirty)
Injection-Date: Wed, 12 May 2021 15:26:31 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Luigi Thirty - Wed, 12 May 2021 15:26 UTC

Okay, cool. I'm close now, but I'm running into an issue passing the return values to sys$crmpsc_pfn64.

VOID_PQ mapped_addr_base;
uint64 mapped_addr_length;
r0_status = sys$crmpsc_pfn_64(
VA$C_P0,
buf/8192,
(1048576*16) / 8192,
PSL$C_USER,
SEC$M_EXPREG|SEC$M_WRT,
&mapped_addr_base,
&mapped_addr_length
);

This fails with an SS$_ACCVIO, meaning VMS can't write to mapped_addr_base or mapped_addr_length according to the system service docs. I'm not sure why that's the case, since I'm just passing it these two variables by reference. buf is the 64-bit physical address to the card. I saw someone else have this problem in another older post but the solution didn't end up on here.

On Tuesday, May 11, 2021 at 8:00:55 AM UTC-5, Roger Ivie wrote:
> On Sunday, May 9, 2021 at 6:44:32 PM UTC-7, lui...@gmail.com wrote:
> > Specifically, the problem is that IOC$MAP_IO returns a handle value which I can't figure
> > out how to resolve to a virtual address, so I don't know where in system memory my PCI
> > device is mapped. Unless the "magic number" it returns happens to be a pointer to an
> > IOHANDLE or something.
> the iohandle holds the *physical* address at which your device is mapped. you use that to create the page frame number you need to hand to the appropriate flavor of $crmpsc to create a pfn-mapped section. $crmpsc gives you the virtual address.
> --
> roger ivie
> roger...@gmail.com

Re: Device Driver Kernel-User Buffer Mapping

<120f0da3-52cc-460e-91ac-1b0d69146744n@googlegroups.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=14764&group=comp.os.vms#14764

  copy link   Newsgroups: comp.os.vms
X-Received: by 2002:a05:622a:413:: with SMTP id n19mr24831236qtx.238.1620835660825;
Wed, 12 May 2021 09:07:40 -0700 (PDT)
X-Received: by 2002:a37:5b46:: with SMTP id p67mr7876911qkb.358.1620835660593;
Wed, 12 May 2021 09:07:40 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!npeer.as286.net!npeer-ng0.as286.net!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.os.vms
Date: Wed, 12 May 2021 09:07:40 -0700 (PDT)
In-Reply-To: <8cdbb5fb-15d8-40fc-8113-d3fdf4996684n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=74.140.8.188; posting-account=CO-_tAoAAACjjs2KLAw3xVKCy6Z_J3VK
NNTP-Posting-Host: 74.140.8.188
References: <11c989a1-fe8f-42c5-8521-eb0682c828c0n@googlegroups.com>
<792ea91d-07b8-4a63-a77f-95327a5cce5dn@googlegroups.com> <1d371858-3a8e-4f4d-9eff-d0db3e9cb147n@googlegroups.com>
<3f17f0a0-8e52-4ab2-95d3-c5e22c75e547n@googlegroups.com> <b79bb79e-927a-4009-9167-3ff9d5123074n@googlegroups.com>
<8cdbb5fb-15d8-40fc-8113-d3fdf4996684n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <120f0da3-52cc-460e-91ac-1b0d69146744n@googlegroups.com>
Subject: Re: Device Driver Kernel-User Buffer Mapping
From: osuvma...@gmail.com (David Jones)
Injection-Date: Wed, 12 May 2021 16:07:40 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2190
 by: David Jones - Wed, 12 May 2021 16:07 UTC

On Wednesday, May 12, 2021 at 11:26:32 AM UTC-4, lui...@gmail.com wrote:
> Okay, cool. I'm close now, but I'm running into an issue passing the return values to sys$crmpsc_pfn64.
>
> VOID_PQ mapped_addr_base;
> uint64 mapped_addr_length;
> r0_status = sys$crmpsc_pfn_64(
> VA$C_P0,
> buf/8192,
> (1048576*16) / 8192,
> PSL$C_USER,
> SEC$M_EXPREG|SEC$M_WRT,
> &mapped_addr_base,
> &mapped_addr_length
> );
>
> This fails with an SS$_ACCVIO, meaning VMS can't write to mapped_addr_base or mapped_addr_length according to the system service docs.

The docs also say the first argument is passed by reference, so it should be &VA$C_P0. I've played with
sys$crmpsc_file_64(), and the first argument for it is the same.

Re: Device Driver Kernel-User Buffer Mapping

<71fcd78b-a7cd-4b0b-80d5-4a794ad4208cn@googlegroups.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=14786&group=comp.os.vms#14786

  copy link   Newsgroups: comp.os.vms
X-Received: by 2002:a05:622a:1493:: with SMTP id t19mr35416309qtx.147.1620869248596;
Wed, 12 May 2021 18:27:28 -0700 (PDT)
X-Received: by 2002:a0c:cdcb:: with SMTP id a11mr38274429qvn.62.1620869248490;
Wed, 12 May 2021 18:27:28 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.os.vms
Date: Wed, 12 May 2021 18:27:28 -0700 (PDT)
In-Reply-To: <120f0da3-52cc-460e-91ac-1b0d69146744n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=173.19.193.52; posting-account=zvIpTQoAAABQJtJR1phhrQImju0wTmq2
NNTP-Posting-Host: 173.19.193.52
References: <11c989a1-fe8f-42c5-8521-eb0682c828c0n@googlegroups.com>
<792ea91d-07b8-4a63-a77f-95327a5cce5dn@googlegroups.com> <1d371858-3a8e-4f4d-9eff-d0db3e9cb147n@googlegroups.com>
<3f17f0a0-8e52-4ab2-95d3-c5e22c75e547n@googlegroups.com> <b79bb79e-927a-4009-9167-3ff9d5123074n@googlegroups.com>
<8cdbb5fb-15d8-40fc-8113-d3fdf4996684n@googlegroups.com> <120f0da3-52cc-460e-91ac-1b0d69146744n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <71fcd78b-a7cd-4b0b-80d5-4a794ad4208cn@googlegroups.com>
Subject: Re: Device Driver Kernel-User Buffer Mapping
From: roger.i...@gmail.com (Roger Ivie)
Injection-Date: Thu, 13 May 2021 01:27:28 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Roger Ivie - Thu, 13 May 2021 01:27 UTC

On Wednesday, May 12, 2021 at 9:07:42 AM UTC-7, osuv...@gmail.com wrote:
> > VOID_PQ mapped_addr_base;
> > uint64 mapped_addr_length;
> > r0_status = sys$crmpsc_pfn_64(
> > VA$C_P0,
> > buf/8192,
> > (1048576*16) / 8192,
> > PSL$C_USER,
> > SEC$M_EXPREG|SEC$M_WRT,
> > &mapped_addr_base,
> > &mapped_addr_length
> > );
> >

peeked at my code while i was at work today (can't read news there, don't have sources here at home). the only things that stand out as obviously different between my codes and yours are 1) yes, va$c_p0 needs to be passed by reference. 2) i included sec$m_pfnmap in the flags; don't recall whether that's necessary, but wouldn't surprise me. 3) i included the
final parameter (which you've omitted here; it's supposed to be optional when sec$m_expreg is set); i passed a zero in that parameter.
--
roger ivie
roger.ivie@gmail.com

Re: Device Driver Kernel-User Buffer Mapping

<b0e7fd19-fdb9-4369-bf09-75cad14bc641n@googlegroups.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=14788&group=comp.os.vms#14788

  copy link   Newsgroups: comp.os.vms
X-Received: by 2002:a0c:e486:: with SMTP id n6mr38560963qvl.21.1620878141397; Wed, 12 May 2021 20:55:41 -0700 (PDT)
X-Received: by 2002:a0c:e6c5:: with SMTP id l5mr39423700qvn.2.1620878141274; Wed, 12 May 2021 20:55:41 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.mixmin.net!fdcspool5.netnews.com!news-out.netnews.com!news.alt.net!fdc3.netnews.com!feeder1.feed.usenet.farm!feed.usenet.farm!tr1.eu1.usenetexpress.com!feeder.usenetexpress.com!tr1.iad1.usenetexpress.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.os.vms
Date: Wed, 12 May 2021 20:55:41 -0700 (PDT)
In-Reply-To: <71fcd78b-a7cd-4b0b-80d5-4a794ad4208cn@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=24.12.66.179; posting-account=jZu0MQoAAAAjASNAm1sGOFyq6JgsLQLi
NNTP-Posting-Host: 24.12.66.179
References: <11c989a1-fe8f-42c5-8521-eb0682c828c0n@googlegroups.com> <792ea91d-07b8-4a63-a77f-95327a5cce5dn@googlegroups.com> <1d371858-3a8e-4f4d-9eff-d0db3e9cb147n@googlegroups.com> <3f17f0a0-8e52-4ab2-95d3-c5e22c75e547n@googlegroups.com> <b79bb79e-927a-4009-9167-3ff9d5123074n@googlegroups.com> <8cdbb5fb-15d8-40fc-8113-d3fdf4996684n@googlegroups.com> <120f0da3-52cc-460e-91ac-1b0d69146744n@googlegroups.com> <71fcd78b-a7cd-4b0b-80d5-4a794ad4208cn@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <b0e7fd19-fdb9-4369-bf09-75cad14bc641n@googlegroups.com>
Subject: Re: Device Driver Kernel-User Buffer Mapping
From: luig...@gmail.com (Luigi Thirty)
Injection-Date: Thu, 13 May 2021 03:55:41 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 29
 by: Luigi Thirty - Thu, 13 May 2021 03:55 UTC

On Wednesday, May 12, 2021 at 8:27:29 PM UTC-5, Roger Ivie wrote:
> On Wednesday, May 12, 2021 at 9:07:42 AM UTC-7, osuv...@gmail.com wrote:
> > > VOID_PQ mapped_addr_base;
> > > uint64 mapped_addr_length;
> > > r0_status = sys$crmpsc_pfn_64(
> > > VA$C_P0,
> > > buf/8192,
> > > (1048576*16) / 8192,
> > > PSL$C_USER,
> > > SEC$M_EXPREG|SEC$M_WRT,
> > > &mapped_addr_base,
> > > &mapped_addr_length
> > > );
> > >
> peeked at my code while i was at work today (can't read news there, don't have sources here at home). the only things that stand out as obviously different between my codes and yours are 1) yes, va$c_p0 needs to be passed by reference. 2) i included sec$m_pfnmap in the flags; don't recall whether that's necessary, but wouldn't surprise me. 3) i included the
> final parameter (which you've omitted here; it's supposed to be optional when sec$m_expreg is set); i passed a zero in that parameter.
> --
> roger ivie
> roger...@gmail.com

Yeah, passing the first parameter by reference was the problem. I don't need the last parameter (I don't care where in my process' virtual address space it gets mapped as long as it's there). I got the card to map and work from a user process. Thanks!

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor