Nonstandard CP violation in the Higgs sector can play an essential role in electroweak baryogenesis. We calculate the full two-loop matching conditions of the standard model, with Higgs Yukawa couplings to light quarks modified to include arbitrary CP-violating phases, onto an effective Lagrangian comprising CP-odd electric and chromoelectric light-quark (up, down, and strange) dipole operators. We find large isospin-breaking contributions of the electroweak diagrams. Using these results, we obtain significant constraints on the phases of the light-quark Yukawas from experimental bounds on the neutron and mercury electric dipole moments.