Here is quick video on how to remove and replace the PCV valve on a 2004 Mazda 6. The job itself isn’t that hard, you will need to take two hoses loose, shown in the video. The hose going to the PCV valve can be pulled off and then you will need to remove a bracket on the firewall also shown in the video. The total job shouldn’t take you more than 15 minutes if that.
Here is a tip, if you are pulling the upper plenum for anything like changing the spark plugs and or coil packs, it would be a better time to change this PCV valve because it will be many time easier to access and change out as apposed to be fully assembled.